Project

General

Profile

Actions

Patch submission #508

closed

gm command created.

Added by Arnaud Tanguy over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
libyzis
Target version:
Start date:
01/18/2009
Due date:
% Done:

100%

Estimated time:

Description

I created the gm command. This commands move the cursor column in the middle of the screen.
It works, but I don't know how to write the validate test, as there are no lua function to get the view width. Do I have to create one ?
This time I added a diff instead of a bundle, as Loïc asked me.


Files

gmCommand.diff (2.41 KB) gmCommand.diff Arnaud Tanguy, 01/18/2009 02:41 PM
gmCommand2.diff (949 Bytes) gmCommand2.diff Arnaud Tanguy, 01/18/2009 04:05 PM
gmCommand.diff (2.24 KB) gmCommand.diff Arnaud Tanguy, 01/18/2009 07:12 PM
lua.diff (2.42 KB) lua.diff Arnaud Tanguy, 01/18/2009 09:26 PM
gmBundle.hg (2.31 KB) gmBundle.hg Arnaud Tanguy, 01/18/2009 10:34 PM
Actions #1

Updated by Loïc P. over 13 years ago

From line 508 to the end of your method :
Warning! motions commans are intended to return buffer position. here you are interested in the column, which is screen related (think about tab rendering).
You'll have to call YView::viewCursorFromLineColumn(line, column) to compute the corresponding buffer position.
You can give a column larger than the line width, but not larger than the screen.

It's ok to create necessary lua functions : put them in a separate patch.

Thank you for your work!

Actions #2

Updated by Arnaud Tanguy over 13 years ago

If I understood well, I should do it like this one.

Actions #3

Updated by Loïc P. over 13 years ago

yes, but you can directly do

return args.view->viewCursorFromLineColumn(cursor.line(), column).buffer();

Actions #4

Updated by Arnaud Tanguy over 13 years ago

Indeed, I should think a little more before posing such rather stupid diffs (I focused on understanding viewCursorFromLineColumn role, and forget to see if my code was the best one)...
Thanks again, I think it is useless to post a diff file.

Actions #5

Updated by Loïc P. over 13 years ago

Arnaud Tanguy wrote:

I think it is useless to post a diff file.

Oh yes it's usefull :) Please post the complete diff file (and not the step by step ones ;))
And if you could add lua tests, it will be great.

Thanks

Actions #6

Updated by Arnaud Tanguy over 13 years ago

So here is the full diff.
I'll work on the lua script.

Actions #7

Updated by Arnaud Tanguy over 13 years ago

I created the needed lua function : screenwidth wich return the view column number used for the tests.
The tests are also created.
Here is the corresponding diff, just ask if you want a bundle.

Actions #8

Updated by Loïc P. over 13 years ago

Yes a bundle would be fine.
Could you also rename scrscreenwidth to screenwidth?
Thx

Actions #9

Updated by Arnaud Tanguy over 13 years ago

Here is the bundle, with the modification.

Actions #10

Updated by Loïc P. over 13 years ago

  • Status changed from New to Closed
  • Assignee set to Loïc P.
  • Target version set to 1.0-alpha2
  • % Done changed from 0 to 100

pushed. Thanks! (r4240..4242)

Actions

Also available in: Atom PDF