Giter Site home page Giter Site logo

Comments (6)

alankilborn avatar alankilborn commented on July 24, 2024 1

Version 8.5 also happens to be the first version where Ctrl+Shift+B was a keyboard shortcut for this command

As that was a change I made, I'll look into it. :-)

@donho Assign me, please.

from notepad-plus-plus.

molsonkiko avatar molsonkiko commented on July 24, 2024

I did some bisection search, and it appears that this issue originated in version 8.5, meaning that the last version where the issue was not present was version 8.4.9.

Version 8.5 also happens to be the first version where Ctrl+Shift+B was a keyboard shortcut for this command, so probably this is some weirdness associated with that change.

from notepad-plus-plus.

alankilborn avatar alankilborn commented on July 24, 2024

It appears to be a difficulty with this line, added in #13034:

execute(SCI_SETSELECTIONMODE, static_cast<WPARAM>(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM));

I suggest to eliminate that line and replace it with:

	if (isColumnMode)
	{
		execute(SCI_SETSELECTIONMODE, static_cast<WPARAM>(SC_SEL_RECTANGLE));
	}

from notepad-plus-plus.

alankilborn avatar alankilborn commented on July 24, 2024

It still feels like the original code should work, but clearly Scintilla doesn't like it.
Maybe @nyamatongwe has some suggestion on how this should be written so that moving the caret with an arrow key after deleting/cutting selected text doesn't create a selection.

from notepad-plus-plus.

nyamatongwe avatar nyamatongwe commented on July 24, 2024

https://www.scintilla.org/ScintillaDoc.html#SCI_CHANGESELECTIONMODE

from notepad-plus-plus.

alankilborn avatar alankilborn commented on July 24, 2024

SCI_CHANGESELECTIONMODE is a newer API I was unfamiliar with. But OK...

It still looks/feels a bit odd, but here's the code I'm thinking of proposing:

void ScintillaEditView::beginOrEndSelect(bool isColumnMode)
{
	auto currPos = execute(SCI_GETCURRENTPOS);
	
	if (_beginSelectPosition == -1)
	{
		_beginSelectPosition = currPos;
	}
	else
	{
		execute(SCI_CHANGESELECTIONMODE, static_cast<WPARAM>(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM));
		execute(isColumnMode ? SCI_SETANCHOR : SCI_SETSEL, 
			static_cast<WPARAM>(_beginSelectPosition), 
			static_cast<LPARAM>(currPos));
		_beginSelectPosition = -1;
	}
}

from notepad-plus-plus.

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.