10000 Hide command input field better by jacekkopecky · Pull Request #777 · atom/vim-mode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.

Hide command input field better #777

Merged
merged 4 commits into from
Aug 17, 2015

Conversation

jacekkopecky
Copy link
Contributor

Also removed the seemingly unnecessary editorContainer; this may
affect people’s personal styles if anybody has applied styles to that
container element.

The change in spec-helper makes sure that the new code’s expectations
are met when testing.

This is an alternative solution to PR #776.

@jacekkopecky jacekkopecky mentioned this pull request Jul 17, 2015
@jacekkopecky
Copy link
Contributor Author

Tested to work with atom and one themes.

@bronson
Copy link
Contributor
bronson commented Jul 17, 2015

Looks great, but I kinda miss the blue outline telling me it's waiting for a key. :) First merge this, then maybe someone can think of an unobtrusive way of making the modes more visible...?

@jacekkopecky
Copy link
Contributor Author

I'm thinking about that. Plus, I use a whole different set of cursors, with an empty rectangle cursor for inactive (which is triggered on f and such because the input line is the active editor then) which tends to be enough of an indication in the heat of coding.
My cursor styles:

@cursor: #29ff2f;
@cursorhi: #00ff00;

atom-text-editor.vim-mode {
  &.command-mode,
  &.operator-pending-mode,
  &.insert-mode
  { &::shadow, & {
      .cursors.blink-off .cursor, .cursors .cursor {
        border: 2px solid @cursor;
        background: none;
        z-index: -1;
        visibility: visible !important;
        opacity: 1;
      }

      .tile {
        background-color: rgba(0,0,0,0) !important;
      }
    }
  }

  &.visual-mode
  { &::shadow, & {
      .cursors.blink-off .cursor, .cursors .cursor {
        border: 2px solid @cursorhi;
        background: none;
        visibility: visible !important;
        opacity: .5;
      }
    }
  }

  &.is-focused {
    &.command-mode,
    { &::shadow, & {
        .cursors.blink-off .cursor, .cursors .cursor {
          border: none;
          background: @cursor;
        }
      }
    }

    &.operator-pending-mode
    { &::shadow, & {
        .cursors.blink-off .cursor, .cursors .cursor {
          border: none;
          border-bottom: 10px solid @cursor;
        }
      }
    }

    &.insert-mode,
    { &::shadow, & {
        .cursors.blink-off .cursor, .cursors .cursor {
          border: none;
          border-left: 3px solid @cursor;
        }
      }
    }

    &.visual-mode
    { &::shadow, & {
        .cursors.blink-off .cursor, .cursors .cursor,
         {
          border: none;
          border-left: 3px solid @cursorhi;
          opacity: .5;
        }
      }
    }

    &.replace-mode
    { &::shadow, & {
        .cursors.blink-off .cursor, .cursors .cursor {
          border: none;
          border-bottom: 4px solid @cursor;
        }
      }
    }
  }
}

@bronson
Copy link
Contributor
bronson commented Jul 18, 2015

I see you use a light colorscheme!

I really like the rectangle operator-pending cursor. Seems like it merits its own PR. I couldn't manage to get it working with my dark colorscheme though, the cursor just disappears when going operator pending. Gotta fiddle with it later.

@bronson
Copy link
Contributor
bronson commented Jul 18, 2015

Just opened a speculative operator-pending PR in #779.

jacekkopecky added a commit to jacekkopecky/vim-mode that referenced this pull request Jul 18, 2015
@maxbrunsfeld
Copy link
Contributor

I'd like to just not add the panel at all if the input is meant to be hidden. The problem is that the editor needs to be somewhere on the DOM in order to be focused. Maybe could just make it 1px x 1px and add it to the body somewhere?

@jacekkopecky jacekkopecky force-pushed the hide-command-input-field branch from ec565cd to 26ef11b Compare August 5, 2015 22:46
@jacekkopecky
Copy link
Contributor Author

@maxbrunsfeld this new and updated version does that - for a hidden input, the editor is invisible, added to the main text editor's parent element. Do you like this better?

@jacekkopecky jacekkopecky force-pushed the hide-command-input-field branch from 26ef11b to 381e56a Compare August 13, 2015 21:30
Also removed the seemingly unnecessary editorContainer, which may
affect people’s personal styles if anybody has applied styles to that
container element.

The change in spec-helper makes sure that the new code’s expectations
are met when testing.
@jacekkopecky jacekkopecky force-pushed the hide-command-input-field branch from 381e56a to 1a064a0 Compare August 17, 2015 11:27
if @panel?
@panel.destroy()
else
this.parentNode.removeChild(this) if this.parentNode?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can avoid a conditional by using this.remove().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I keep forgetting about that one...

@maxbrunsfeld
Copy link
Contributor

Really glad to see this fixed. I left some very minor feedback.

@jacekkopecky
Copy link
Contributor Author

All done, thank you.

@maxbrunsfeld
Copy link
Contributor

👌 Great!

maxbrunsfeld pushed a commit that referenced this pull request Aug 17, 2015
@maxbrunsfeld maxbrunsfeld merged commit d217e83 into atom:master Aug 17, 2015
@jacekkopecky jacekkopecky deleted the hide-command-input-field branch August 17, 2015 21:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0