[vim/vim] Add the screenpos2col() function (PR #10477)

13 views
Skip to first unread message

Yegappan Lakshmanan

unread,
May 25, 2022, 12:52:57 AM5/25/22
to vim/vim, Subscribed

Addresses the request made in #10098.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/10477

Commit Summary

  • 209a623 Add the screenpos2col() function

File Changes

(6 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477@github.com>

codecov[bot]

unread,
May 25, 2022, 1:03:58 AM5/25/22
to vim/vim, Subscribed

Codecov Report

Merging #10477 (209a623) into master (4c3d21a) will increase coverage by 0.91%.
The diff coverage is 88.23%.

@@            Coverage Diff             @@

##           master   #10477      +/-   ##

==========================================

+ Coverage   81.62%   82.54%   +0.91%     

==========================================

  Files         158      148      -10     

  Lines      185125   172492   -12633     

  Branches    41875    39009    -2866     

==========================================

- Hits       151110   142383    -8727     

+ Misses      21499    17489    -4010     

- Partials    12516    12620     +104     
Flag Coverage Δ
huge-clang-none 82.54% <88.23%> (-0.01%) ⬇️
linux 82.54% <88.23%> (-0.01%) ⬇️
mingw-x64-HUGE ?
mingw-x64-HUGE-gui ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/evalfunc.c 89.62% <ø> (-1.12%) ⬇️
src/move.c 88.74% <88.23%> (-1.20%) ⬇️
src/highlight.c 78.69% <0.00%> (-2.64%) ⬇️
src/misc2.c 86.38% <0.00%> (-2.62%) ⬇️
src/help.c 80.07% <0.00%> (-2.38%) ⬇️
src/buffer.c 84.09% <0.00%> (-2.36%) ⬇️
src/time.c 87.08% <0.00%> (-2.35%) ⬇️
src/libvterm/src/screen.c 51.96% <0.00%> (-2.04%) ⬇️
src/session.c 63.15% <0.00%> (-1.94%) ⬇️
src/gui.c 71.15% <0.00%> (-1.89%) ⬇️
... and 131 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c3d21a...209a623. Read the comment docs.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/c1136729019@github.com>

Bram Moolenaar

unread,
May 25, 2022, 10:17:53 AM5/25/22
to vim/vim, Subscribed


Yegappan wrote:

> Addresses the request made in #10098.

The help should mention that zero can be used for the current window.

It would be good (but more work) to check a wrapping line with
'breakindent' set. Could add this in test_breakindent.vim somewhere.

--
Eight Megabytes And Continually Swapping.

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/c1137312623@github.com>

Yegappan Lakshmanan

unread,
May 25, 2022, 10:58:12 PM5/25/22
to vim/vim, Subscribed

It would be good (but more work) to check a wrapping line with 'breakindent' set.
Could add this in test_breakindent.vim somewhere.

Currently the screenpos2col() function takes the buffer line number and the
screen column number and returns the buffer column number (byte offset).
Should we change this so that the function takes the screen line number
and screen column number and returns the buffer column number?
In this case, it will work only if the specified line is visible in a window.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/c1138094464@github.com>

zeertzjq

unread,
May 25, 2022, 11:15:32 PM5/25/22
to vim/vim, Subscribed

Looking at the implementation, maybe this function name can be changed to virtcol2col()?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/c1138104057@github.com>

Yegappan Lakshmanan

unread,
May 25, 2022, 11:54:24 PM5/25/22
to vim_dev, reply+ACY5DGBGNFIIB3UNGZ...@reply.github.com, vim/vim, Subscribed
Hi,

On Wed, May 25, 2022 at 8:15 PM zeertzjq <vim-dev...@256bit.org> wrote:

Looking at the implementation, maybe this function name can be changed to virtcol2col()?



Yes. As the function is accepting the buffer line number instead of the screen
line number, it makes sense to name this virtcol2col().

Regards,
Yegappan
 

vim-dev ML

unread,
May 25, 2022, 11:54:38 PM5/25/22
to vim/vim, vim-dev ML, Your activity

Hi,


On Wed, May 25, 2022 at 8:15 PM zeertzjq ***@***.***> wrote:

> Looking at the implementation, maybe this function name can be changed to
> virtcol2col()?
>
>
>
Yes. As the function is accepting the buffer line number instead of the
screen
line number, it makes sense to name this virtcol2col().

Regards,
Yegappan


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/c1138125114@github.com>

Bram Moolenaar

unread,
May 26, 2022, 10:26:50 AM5/26/22
to vim/vim, vim-dev ML, Comment


> > It would be good (but more work) to check a wrapping line with
> > 'breakindent' set. Could add this in test_breakindent.vim somewhere.
>
> Currently the screenpos2col() function takes the buffer line number and the
> screen column number and returns the buffer column number (byte offset).
> Should we change this so that the function takes the screen line number
> and screen column number and returns the buffer column number?
> In this case, it will work only if the specified line is visible in a window.

The function name is confusing - it does not actually take a screen
position but a virtual column number. If I'm not mistaken that virtual
column number would come from virtcol(). For a virtual column the
display options don't apply.

Also consider screenpos(), which returns the screen row and column, not
the buffer line and virtual column.

Using virtcol2col() for the name sounds alright.

An actual screenpos2col(), doing the opposite of screenpos(), would also
be useful.

Keep in mind that I plan (at some time...) to make screenpos() work with
the 'conceal' feature, thus the function for the opposite should also be
able to do this. That is mostly for fixing the long standing bug that
the cursor positioning is wrong when characters are concealed and
clicking with the mouse.

--
You had connectors? Eeee, when I were a lad we 'ad to carry the
bits between the computer and the terminal with a spoon...


/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/10477/c1138637448@github.com>

Yegappan Lakshmanan

unread,
May 27, 2022, 1:07:17 PM5/27/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 1 commit.

  • 5f2d861 Rename screenpos2col() to virtcol2col()


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/push/10002921579@github.com>

Yegappan Lakshmanan

unread,
May 27, 2022, 1:08:36 PM5/27/22
to vim/vim, vim-dev ML, Push

@yegappan pushed 2 commits.

  • 210b76e Add the screenpos2col() function
  • 0410590 Rename screenpos2col() to virtcol2col()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/10477/push/10002933454@github.com>

Bram Moolenaar

unread,
May 27, 2022, 4:58:22 PM5/27/22
to vim/vim, vim-dev ML, Comment

Closed #10477 via 5a6ec10.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/10477/issue_event/6695415464@github.com>

Reply all
Reply to author
Forward
0 new messages