Project

General

Profile

Actions

Patch submission #318

closed

Screen Movement implementation "H", "L", "M"

Added by David Gayou over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
libyzis
Target version:
Start date:
09/01/2008
Due date:
% Done:

100%

Estimated time:

Description

Implementation of the commands "_n_H", "_n_L" and "_n_M", that move cursor to top, bottom, middle line of screen ( +n, -n, +n).

It manage the end file issue when last line of text aren't the last line of screen.

note : in vim, the argument n for the "H" command isn't implemented. As i see no reason, it would be better not to implement it. I did it with middle line of screen +n lines. If needed i can remove it pretty easily. There's a commented line in mode_command.cpp YModeCommand::middleScreen to make it work as in vim.


Files

screenMovement.patch (5.79 KB) screenMovement.patch David Gayou, 09/01/2008 11:09 AM
LHM.bundle (2.17 KB) LHM.bundle Arnaud Tanguy, 01/14/2009 03:12 PM
Actions #1

Updated by Loïc P. over 13 years ago

Can you update your patch against the new api ?
Thx :)

Actions #2

Updated by Arnaud Tanguy over 13 years ago

It's the first time I send a patch, so sorry if I made some mistakes.
I created the 3 commands before seeing this first submission (I just began two days ago looking into the Yzis code see this if you want details).

So the functions I created are moveFromTop, moveFromBottom and moveToMiddle. I also created my first lua script for testing the behavior of these functions.

Actions #3

Updated by Thomas Capricelli over 13 years ago

yes, i've had a look at the patch, and it looks great. Few remarks:
  • your name as commiter is 'arnaud@debian', which you probably want to change for something more useful. for that you need to add a line like this in your ~/.hgrc
    [ui]
    username = Thomas Capricelli <orzel@freehackers.org>
    
  • make the patch as small as possible. Lot of your patch is about reverting some previous changes. This probably happen because you made your modification on some old (read 'one week') files, and you copied the files on top of a recent checkout. This is very dangerous. For example in mode_command.h your remove a TODO and this, in mode_command.cpp, is also a revert:
    @@ -1083,14 +1126,13 @@
     {
         YCursor ret;
         YViewCursor viewCursor = args.view->viewCursor();
    -    QChar asChar = *(*(args.parsePos));
         YViewMarker *mark = args.view->buffer()->viewMarks();
    -    if ( mark->contains(asChar)){
    -        *state = CmdOk;
    -        ret =  mark->value(asChar).buffer();
    +    if ( mark->contains(QChar(*(*args.parsePos))) ) {
    +      *state = CmdOk;
    +        ret =  mark->value( QChar(*(*args.parsePos)) ).buffer();
         }
         else {
    -        dbg() << "WARNING! mark " << asChar << " not found" << endl;
    +        dbg() << "WARNING! mark " << QChar(*(*args.parsePos)) << " not found" << endl;
             *state = CmdStopped;
             ret =  viewCursor.buffer();
         }
    

Because of this, i will not just integrate the bundle (else we would go 'back' in history because of the revert), but apply only the relevant part of your patch.

You can check what your patch is before committing with 'hg diff', and once commited, you can use 'hg view' to see the diffs. 'hg view' is really useful :)
You

Actions #4

Updated by Thomas Capricelli over 13 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applicata nel changeset r4207.

Actions #5

Updated by Thomas Capricelli over 13 years ago

  • Target version set to 1.0-alpha2
Actions #6

Updated by Arnaud Tanguy over 13 years ago

Thank you for integrating my bad patch (sorry for that).
There is something I don't understand : I got the source with "hg clone http://sources.freehackers.org/Yzis/" two days ago, so I should have a recent source version, isn't it? So why does my patch correspond to an old version of the source ?

I set my commiter name. When I created the patch, I noticed a message saying me my commiter name, but I didn't know how to modify it, so thank you for the tip.

Thanks for the commands "hg diff" and "hg view". I just downloaded a little book about mercurial, so I'll read it because it's not a good thing taking your time each time just to commit a simple patch...

I'll look into your modifications, and I'll try to think of adding my lua script to the test_all one.

Sorry again for the problems, I'll try to do better next time.

Actions #7

Updated by Thomas Capricelli over 13 years ago

No problem. Please drop by on IRC (#yzis on irc.freenode.net) if you want to talk. I could explain you why the patch was against an old version.
:-)

Actions

Also available in: Atom PDF