Git Product home page Git Product logo

Comments (2)

fidgetingbits avatar fidgetingbits commented on June 24, 2024 1

It's not identical. My thinking is that you would call it with something like vim.fn.getpos("'>") and vim.fn.getpos("'>") as the visual selection start/end positions to get back most of the coordinates you are currently trying to compute yourself. Probably the majority of buffer_get_selection()'s logic would be replaced by a call to vim.fn.getregionpos(). But ya, would need to test to make sure it can be used.

from cursorless.

saidelike avatar saidelike commented on June 24, 2024

Maybe i misread https://github.com/vim/vim/pull/14617/files#diff-ef8946d89919ad628b9ac65c49d3067e4e017b0980cac70eb25d832a59ef677dR4332 but is it the same?

  • getregionpos() takes arguments but buffer_get_selection() does not
getregionpos({pos1}, {pos2} [, {opts}])            *getregionpos()*
		Same as |getregion()|, but returns a list of positions
		describing the buffer text segments bound by {pos1} and
		{pos2}.
		The segments are a pair of positions for every line:
                    [[{pos_start}, {pos_end}], ...]

		The position is a |List| with four numbers:
		    [bufnum, lnum, col, off]
		"bufnum" is the buffer number.
		"lnum" and "col" are the position in the buffer.  The first
		column is 1.
		The "off" number is zero, unless 'virtualedit' is used.  Then
		it is the offset in screen columns from the start of the
		character.  E.g., a position within a <Tab> or after the last
		character.

		Can also be used as a |method|: >
			getpos('.')->getregionpos(getpos("'a"))
<

from cursorless.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.