GithubHelp home page GithubHelp logo

Comments (6)

davidegiacometti avatar davidegiacometti commented on August 17, 2024 1

@jcormier
You're absolutely right.. My solution is wrong and your patch is working fine!
I have fixed the 0.5.3 with the correct code.
Thank you for the contribution! 😃

from redmine_shortcuts.

davidegiacometti avatar davidegiacometti commented on August 17, 2024

Hi @jcormier
Nice catch!
This is affecting only textile and looks related to the </pre> tag.
I am going to release a bug fix.

from redmine_shortcuts.

jcormier avatar jcormier commented on August 17, 2024

While your patch works, I still think it's wrong and very hacky. I don't see any reason that selectionEnd would depend on the length of the text added after the selection, these offsets are all relative to the start of the text box, it should only depend on the prepend length as my proposed patch does.

Only the slicing really cares about the length of the append text...

from redmine_shortcuts.

davidegiacometti avatar davidegiacometti commented on August 17, 2024

The selected text on the textarea depends on both prepended and appended tags.

  • Create a new issue and focus the text area
  • Write some text
  • Select the text (CTRL + A)
  • Add the preformatted tags (CTRL + P)
  • The entire text is selected

from redmine_shortcuts.

jcormier avatar jcormier commented on August 17, 2024

Existing Text - Selected start = 0, end = 13

After pre

pre text - pre.length = 8
Existing Text - Selected start = 0 + 8, end = 13 + 8
post text - post.length = 9

It doesn't matter how large post text is, the selection start/end positions stay the same

from redmine_shortcuts.

jcormier avatar jcormier commented on August 17, 2024

Note: Should have added +1 to pre and post lengths for newlines..., but it doesn't change the math.

from redmine_shortcuts.

Related Issues (9)

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.