Patch 8.2.4559

10 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 13, 2022, 11:54:00 AM3/13/22
to vim...@googlegroups.com

Patch 8.2.4559 (after 8.24555)
Problem: getmousepos() returns the screen column. (Ernie Rael)
Solution: Return the text column, as documented.
Files: src/mouse.c, src/testdir/test_functions.vim


*** ../vim-8.2.4558/src/mouse.c 2022-03-13 12:06:02.076218096 +0000
--- src/mouse.c 2022-03-13 15:47:50.130233218 +0000
***************
*** 3065,3071 ****
varnumber_T winid = 0;
varnumber_T winrow = 0;
varnumber_T wincol = 0;
! linenr_T line = 0;
varnumber_T column = 0;

if (rettv_dict_alloc(rettv) != OK)
--- 3065,3071 ----
varnumber_T winid = 0;
varnumber_T winrow = 0;
varnumber_T wincol = 0;
! linenr_T lnum = 0;
varnumber_T column = 0;

if (rettv_dict_alloc(rettv) != OK)
***************
*** 3099,3112 ****
col -= left_off;
if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width)
{
! int count;
!
! mouse_comp_pos(wp, &row, &col, &line, NULL);
!
! // limit to text size plus one
! count = linetabsize(ml_get_buf(wp->w_buffer, line, FALSE));
! if (col > count)
! col = count;
column = col + 1;
}
}
--- 3099,3106 ----
col -= left_off;
if (row >= 0 && row < wp->w_height && col >= 0 && col < wp->w_width)
{
! if (!mouse_comp_pos(wp, &row, &col, &lnum, NULL))
! col = vcol2col(wp, lnum, col);
column = col + 1;
}
}
***************
*** 3114,3120 ****
dict_add_number(d, "winid", winid);
dict_add_number(d, "winrow", winrow);
dict_add_number(d, "wincol", wincol);
! dict_add_number(d, "line", (varnumber_T)line);
dict_add_number(d, "column", column);
}
#endif
--- 3108,3114 ----
dict_add_number(d, "winid", winid);
dict_add_number(d, "winrow", winrow);
dict_add_number(d, "wincol", wincol);
! dict_add_number(d, "line", (varnumber_T)lnum);
dict_add_number(d, "column", column);
}
#endif
*** ../vim-8.2.4558/src/testdir/test_functions.vim 2022-03-13 12:06:02.076218096 +0000
--- src/testdir/test_functions.vim 2022-03-13 15:49:41.633915091 +0000
***************
*** 2753,2758 ****
--- 2753,2768 ----
func Test_getmousepos()
enew!
call setline(1, "\t\t\t1234")
+ call test_setmouse(1, 1)
+ call assert_equal(#{
+ \ screenrow: 1,
+ \ screencol: 1,
+ \ winid: win_getid(),
+ \ winrow: 1,
+ \ wincol: 1,
+ \ line: 1,
+ \ column: 1,
+ \ }, getmousepos())
call test_setmouse(1, 25)
call assert_equal(#{
\ screenrow: 1,
***************
*** 2761,2767 ****
\ winrow: 1,
\ wincol: 25,
\ line: 1,
! \ column: 25,
\ }, getmousepos())
call test_setmouse(1, 50)
call assert_equal(#{
--- 2771,2777 ----
\ winrow: 1,
\ wincol: 25,
\ line: 1,
! \ column: 4,
\ }, getmousepos())
call test_setmouse(1, 50)
call assert_equal(#{
***************
*** 2771,2777 ****
\ winrow: 1,
\ wincol: 50,
\ line: 1,
! \ column: 29,
\ }, getmousepos())
bwipe!
endfunc
--- 2781,2787 ----
\ winrow: 1,
\ wincol: 50,
\ line: 1,
! \ column: 8,
\ }, getmousepos())
bwipe!
endfunc
*** ../vim-8.2.4558/src/version.c 2022-03-13 14:44:59.400422412 +0000
--- src/version.c 2022-03-13 15:52:10.441496216 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4559,
/**/

--
hundred-and-one symptoms of being an internet addict:
251. You've never seen your closest friends who usually live WAY too far away.

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

John Marriott

unread,
Mar 13, 2022, 2:55:29 PM3/13/22
to vim...@googlegroups.com

On 14-Mar-2022 02:53, Bram Moolenaar wrote:
> Patch 8.2.4559 (after 8.24555)
> Problem: getmousepos() returns the screen column. (Ernie Rael)
> Solution: Return the text column, as documented.
> Files: src/mouse.c, src/testdir/test_functions.vim
>
>
After this patch, mingw64 (gcc 11.2.0) throws this linker error for a
non-gui build:
<snip>
gcc -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -Wl,-nxcompat,-dynamicbase -municode -s  -o vim.exe
objnative/alloc.o objnative/arabic.o objnative/arglist.o
objnative/autocmd.o objnative/beval.o objnative/blob.o
objnative/blowfish.o objnative/buffer.o objnative/bufwrite.o
objnative/change.o objnative/charset.o objnative/cindent.o
objnative/clientserver.o objnative/clipboard.o objnative/cmdexpand.o
objnative/cmdhist.o objnative/crypt.o objnative/crypt_zip.o
objnative/debugger.o objnative/dict.o objnative/diff.o
objnative/digraph.o objnative/drawline.o objnative/drawscreen.o
objnative/edit.o objnative/eval.o objnative/evalbuffer.o
objnative/evalfunc.o objnative/evalvars.o objnative/evalwindow.o
objnative/ex_cmds.o objnative/ex_cmds2.o objnative/ex_docmd.o
objnative/ex_eval.o objnative/ex_getln.o objnative/fileio.o
objnative/filepath.o objnative/findfile.o objnative/float.o
objnative/fold.o objnative/getchar.o objnative/gui_xim.o
objnative/hardcopy.o objnative/hashtab.o objnative/help.o
objnative/highlight.o objnative/if_cscope.o objnative/indent.o
objnative/insexpand.o objnative/json.o objnative/list.o
objnative/locale.o objnative/main.o objnative/map.o objnative/mark.o
objnative/match.o objnative/memfile.o objnative/memline.o
objnative/menu.o objnative/message.o objnative/misc1.o objnative/misc2.o
objnative/mouse.o objnative/move.o objnative/mbyte.o objnative/normal.o
objnative/ops.o objnative/option.o objnative/optionstr.o
objnative/os_mswin.o objnative/os_win32.o objnative/pathdef.o
objnative/popupmenu.o objnative/popupwin.o objnative/profiler.o
objnative/quickfix.o objnative/regexp.o objnative/register.o
objnative/scriptfile.o objnative/screen.o objnative/search.o
objnative/session.o objnative/sha256.o objnative/sign.o
objnative/spell.o objnative/spellfile.o objnative/spellsuggest.o
objnative/strings.o objnative/syntax.o objnative/tag.o objnative/term.o
objnative/testing.o objnative/textformat.o objnative/textobject.o
objnative/textprop.o objnative/time.o objnative/typval.o objnative/ui.o
objnative/undo.o objnative/usercmd.o objnative/userfunc.o
objnative/version.o objnative/vim9cmds.o objnative/vim9compile.o
objnative/vim9execute.o objnative/vim9expr.o objnative/vim9instr.o
objnative/vim9script.o objnative/vim9type.o objnative/viminfo.o
objnative/winclip.o objnative/window.o objnative/os_w32exe.o
objnative/vimres.o objnative/xdiffi.o objnative/xemit.o
objnative/xprepare.o objnative/xutils.o objnative/xhistogram.o
objnative/xpatience.o objnative/iscygpty.o -lkernel32 -luser32 -lgdi32
-ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lole32 -luuid
d:/users/john/documents/software/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
objnative/mouse.o:mouse.c:(.text+0x318c): undefined reference to `vcol2col'
collect2.exe: error: ld returned 1 exit status
make: *** [Make_cyg_ming.mak:1107: vim.exe] Error 1
make: Target 'all' not remade because of errors.
</snip>

Sorry, I don't have a patch for this.

Cheers
John

Bram Moolenaar

unread,
Mar 13, 2022, 3:25:15 PM3/13/22
to vim...@googlegroups.com, John Marriott

John Marriott wrote:

> On 14-Mar-2022 02:53, Bram Moolenaar wrote:
> > Patch 8.2.4559 (after 8.24555)
> > Problem: getmousepos() returns the screen column. (Ernie Rael)
> > Solution: Return the text column, as documented.
> > Files: src/mouse.c, src/testdir/test_functions.vim
> >
> >
> After this patch, mingw64 (gcc 11.2.0) throws this linker error for a=20
> non-gui build:
> <snip>
> objnative/mouse.o:mouse.c:(.text+0x318c): undefined reference to `vcol2col'
> collect2.exe: error: ld returned 1 exit status
> make: *** [Make_cyg_ming.mak:1107: vim.exe] Error 1
> make: Target 'all' not remade because of errors.
> </snip>
>
> Sorry, I don't have a patch for this.

Forgot to update the #ifdef. Patch coming...

--
hundred-and-one symptoms of being an internet addict:
252. You vote for foreign officials.
Reply all
Reply to author
Forward
0 new messages