Giter VIP home page Giter VIP logo

Comments (1)

AshlinHarris avatar AshlinHarris commented on September 21, 2024

Hey @TheCedarPrince. I love this suggestion! I got the feature working locally by replacing the existing methods of edit_move_right with the following:

function edit_move_right(q::MIState)
    s = state(q)
    buf = s.input_buffer
    completions, partial, should_complete = complete_line(s.p.complete, s, q.active_module)::Tuple{Vector{String},String,Bool}
    if !eof(buf)
        # move to the next base UTF8 character to the right
        while true
            c = char_move_right(buf)
            eof(buf) && break
            pos = position(buf)
            nextc = read(buf,Char)
            seek(buf,pos)
            (textwidth(nextc) != 0 || nextc == '\n') && break
        end
        refresh_line(state(s)) 
        return true
    elseif should_complete && length(completions) == 1 && length(partial) > 1
        # Replace word by completion
        prev_pos = position(s)
        push_undo(s)
        edit_splice!(s, (prev_pos - sizeof(partial)) => prev_pos, completions[1])
        refresh_line(state(s)) 
        return true
    end
    return false
end

I had to rewrite the function to take an ::MIState input in order to access all the necessary variables. Then, I basically just inserted the relevant code for the Tab key behavior. Normally, the right arrow key does nothing at the end of a line, but now it should complete the line if an autocomplete option is displayed (i.e., there is one unique autocomplete option and more than 1 character has been typed).

This is a quick hack, and I don't fully understand what all the State variables are doing, so I'll revise it and add some tests. But I don't see any downside to your suggested feature, so I plan to make a pull request soon.

from julia.

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.