Sunday, July 18, 2010

Re: Planning Vim 7.3

On 17. 07. 2010 21:26, Bram Moolenaar wrote:
>
> I had a look at the patch. It doesn't include documentation, thus it's
> not easy to see how to use it.

Here is an updated patch with minimal documentation added to
if_pyth.txt and a minor update in if_python.c.

Basically the patch exposes a few window attributes and a
new vim.screen object with two methods.

The new window attributes are: window.left, window.top and
window.wcursor. The attribute window.width is now exposed
uncontitionally (previously it was available only when
FEAT_VERTSPLIT was defined). With these attributes it is
possible to get the location of the cursor inside the window
(the old window.cursor is expressed in the number of
vim-lines/columns, not screen lines/columns).

The two methods of the screen object are used to write
strings directly to the vim screen (screen.puts) and to get
the raw attribute values of vim syntax elements
(screen.getHighlightAttr) which can be subsequently used
with puts. The parameters in puts are modelled after the
function puts in ncurses (the patch was developed as a part
of vimscript 2606 which initially only used ncurses).

All the functionality could also be implemented in VimScript
so that it could be used by other plugins:

- puts: a new function that exposes
screen_puts_len()
in VimScript (length could be omitted)

- getHihghlightAttr: expose a function that calls:
int id = syn_name2id(name);
int attr = syn_id2attr(id);
return attr

- a new function: get_win_cursor({nr}), returns a list:
(long)(this->win->w_wrow), (long)(this->win->w_wcol)

- a new function: get_win_pos({nr}), returns a list:
(long)(W_WINROW(this->win)), (long)(W_WINCOL(this->win))

- winwidth() and winheight() already exist

I'm not acquainted with VimScript internals but I think it
shouldn't be too hard to do this.

>
> Also, I have included support for Python 3 now. Can the same be done
> for that?
>

Currently I'm not using Python 3 but judging from a diff
between if_python.c and if_python3.c this could be done.
Most of the patch could just be copied into if_python3.c
except the screen object structure which should be changed.

Marko

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: