Changeset d7043b4


Ignore:
Timestamp:
Jul 11, 2009, 1:14:33 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
a0fbdee
Parents:
19f765d
git-author:
Karl Ramm <kcr@1ts.org> (06/08/09 10:45:55)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:33)
Message:
simplify line_move goal_column logic
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r19f765d rd7043b4  
    791791int owl_editwin_line_move(owl_editwin *e, int delta)
    792792{
    793   int goal_column, change, ll, count = 0, distance = 0;
    794 
    795   if (e->goal_column == -1) {
    796     if (owl_editwin_at_beginning_of_line(e))
    797       goal_column = 0;
    798     else {
    799       goal_column = -owl_editwin_move_if_not_in(e, -1, "\n");
    800       if (!owl_editwin_at_beginning_of_buffer(e))
    801         goal_column -= owl_editwin_point_move(e, 1);
    802     }
    803   } else
    804     goal_column = e->goal_column;
     793  int goal_column, change, ll, distance;
     794  int count = 0;
    805795
    806796  change = MAX(delta, -delta);
    807797
    808   distance += owl_editwin_move_to_beginning_of_line(e);
     798  goal_column = e->goal_column;
     799  distance = owl_editwin_move_to_beginning_of_line(e);
     800  goal_column = goal_column == -1 ? -distance : goal_column;
    809801
    810802  while(count < change) {
Note: See TracChangeset for help on using the changeset viewer.