gotocol.patch

David Gayou, 08/28/2008 11:40 PM

Download (3.2 KB)

 
b/libyzis/mode_command.cpp Thu Aug 28 23:37:08 2008 +0200
139 139
    motions.append( new YMotion(YKeySequence("-"), &YModeCommand::firstNonBlankPreviousLine, ArgNone) );
140 140
    motions.append( new YMotion(YKeySequence("gg"), &YModeCommand::gotoLine, ArgNone) );
141 141
    motions.append( new YMotion(YKeySequence("G"), &YModeCommand::gotoLine, ArgNone) );
142
    motions.append( new YMotion(YKeySequence("|"), &YModeCommand::gotoColumn, ArgNone) );
142 143
    motions.append( new YMotion(YKeySequence("}"), &YModeCommand::nextEmptyLine, ArgNone) );
143 144
    motions.append( new YMotion(YKeySequence("{"), &YModeCommand::previousEmptyLine, ArgNone) );
144 145
    motions.append( new YMotion(YKeySequence("<C-b>"), &YModeCommand::scrollPageUp) );
......
1206 1207
    return viewCursor.buffer();
1207 1208
}
1208 1209

  
1210
YCursor YModeCommand::gotoColumn(const YMotionArgs &args, CmdState *state)
1211
{
1212
    YViewCursor viewCursor = args.view->viewCursor();
1213
    int column = 0;
1214
    dbg() << "gotoColumn," << args.count << endl;
1215
    *state = CmdOk;
1216

  
1217
    if (args.count >0) column = args.count -1;
1218

  
1219
    args.view->gotoColumn( &viewCursor, column, args.standalone );
1220

  
1221
    YSession::self()->saveJumpPosition();
1222

  
1223
    return viewCursor.buffer();
1224
}
1225

  
1209 1226
YCursor YModeCommand::searchWord(const YMotionArgs &args, CmdState *state)
1210 1227
{
1211 1228
    YCursor from = args.view->getBufferCursor();
b/libyzis/mode_command.h Thu Aug 28 23:37:08 2008 +0200
234 234
    YCursor firstNonBlankNextLine(const YMotionArgs &args, CmdState *state);
235 235
    YCursor firstNonBlankPreviousLine(const YMotionArgs &args, CmdState *state);
236 236
    YCursor gotoLine(const YMotionArgs &args, CmdState *state);
237
    YCursor gotoColumn(const YMotionArgs &args, CmdState *state);
237 238
    YCursor searchWord(const YMotionArgs &args, CmdState *state);
238 239
    YCursor searchNext(const YMotionArgs &args, CmdState *state);
239 240
    YCursor searchPrev(const YMotionArgs &args, CmdState *state);
b/libyzis/view.cpp Thu Aug 28 23:37:08 2008 +0200
878 878
    }
879 879
}
880 880

  
881
void YView::gotoColumn( YViewCursor* viewCursor, int column, bool applyCursor)
882
{ 
883
    //Test if it ask to go after the end of the line
884
    if( column > mBuffer->textline( viewCursor->bufferY() ).length() )
885
        column = mBuffer->textline( viewCursor->bufferY() ).length();
886

  
887
    gotodxdy(viewCursor, ( column%mColumnsVis ), (viewCursor->bufferY() + (column / mColumnsVis) ), applyCursor );
888
}
889

  
881 890
QString YView::moveToEndOfLine( )
882 891
{
883 892
    return moveToEndOfLine( &mainCursor );
b/libyzis/view.h Thu Aug 28 23:37:08 2008 +0200
371 371
     */
372 372
    void gotoLine( int line );
373 373
    void gotoLine( YViewCursor* viewCursor, int line, bool applyCursor = true );
374

  
375
    /**
376
     *Go to column of the line
377
     */
378
    void gotoColumn( YViewCursor* viewCursor, int row, bool applyCursor);
374 379

  
375 380
    /**
376 381
     * Go to last line of the file