Coder Social home page Coder Social logo

Comments (1)

chrisbra avatar chrisbra commented on July 4, 2024

Wow, that is a very bad example. The following patch fixes it (will create a PR soon):

diff --git a/src/textobject.c b/src/textobject.c
index 1890d7c83..aa2db0770 100644
--- a/src/textobject.c
+++ b/src/textobject.c
@@ -1426,15 +1426,22 @@ again:

     if (!do_include)
     {
-       // Exclude the start tag.
+       // Exclude the start tag,
+       // but skip over '>' if it appears in quotes
+       int in_quotes = FALSE;
        curwin->w_cursor = start_pos;
        while (inc_cursor() >= 0)
-           if (*ml_get_cursor() == '>')
+       {
+           p = ml_get_cursor();
+           if (*p == '>' && !in_quotes)
            {
                inc_cursor();
                start_pos = curwin->w_cursor;
                break;
            }
+           else if (*p == '"' || *p == '\'')
+               in_quotes = !in_quotes;
+       }
        curwin->w_cursor = end_pos;

        // If we are in Visual mode and now have the same text as before set

from vim.

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.