/* ** Update a selection across buffer modifications specified by ** "pos", "nDeleted", and "nInserted". */ static void maintainSelection(selection *sel, int pos, int nInserted, int nDeleted) { if (!sel->selected || pos > sel->end) return; maintainPosition(&sel->start, pos, nInserted, nDeleted); maintainPosition(&sel->end, pos, nInserted, nDeleted); if (sel->end <= sel->start) sel->selected = False; }
/* ** Keep the marks in the windows book-mark table up to date across ** changes to the underlying buffer */ void UpdateMarkTable(WindowInfo *window, int pos, int nInserted, int nDeleted) { int i; for (i=0; i<window->nMarks; i++) { maintainSelection(&window->markTable[i].sel, pos, nInserted, nDeleted); maintainPosition(&window->markTable[i].cursorPos, pos, nInserted, nDeleted); } }
/** * Stop the robot. */ void stopPosition(PidMotion* pidMotion, bool maintainPositionValue, OutputStream* notificationOutputStream) { updateTrajectoryAndClearCoders(); if (maintainPositionValue) { maintainPosition(pidMotion, notificationOutputStream); } // Avoid that the robot considered he will remain the initial speed for next move (it is stopped). clearInitialSpeeds(pidMotion); DualHBridgeMotor* dualHBridgeMotor = pidMotion->dualHBridgeMotor; stopMotors(dualHBridgeMotor); }
/** * Stop the robot. */ void stopPosition(bool maintainPositionValue) { updateTrajectoryAndClearCoders(); if (maintainPositionValue) { maintainPosition(); } else { // Avoid that robot reachs his position, and stops the motors setMustReachPosition(false); } // Avoid that the robot considered he will remain the initial speed for next move (it is stopped). clearInitialSpeeds(); stopMotors(); }