Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt gui: Allow TextView selectedString_ to work if selection size is 0 #2648

Merged
merged 1 commit into from Jan 16, 2017

Conversation

jamshark70
Copy link
Contributor

So I just wrote DDWSnippets, and part of the intent was to allow its use with TextViews, but then I found:

t = TextView(nil, Rect(800, 200, 500, 400)).front;
t.selectedString_("test");

Guess what... this inserts nothing.

Why? Because QcTextEdit declares that you should not be able to insert text if there is no current selection spanning at least one character, by accidentally putting cursor.insertText( string ); inside the if block.

void QcTextEdit::replaceSelectedText( const QString &string )
{
  QTextCursor cursor( textCursor() );
  if( cursor.hasSelection() ) {
    cursor.removeSelectedText();
    cursor.insertText( string );
  }
}

Document:selectedString_ does not share this restriction.

Fixed here.

@jamshark70 jamshark70 added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead labels Jan 16, 2017
Copy link
Contributor

@mossheim mossheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works great, thanks for catching this!

@telephon telephon merged commit e58bfc3 into supercollider:master Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: Qt GUI sclang Qt components -- for IDE tickets, use "env: SCIDE" instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants