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

Allow proposing a move in cli #26

Closed
jkomoros opened this issue Jan 31, 2017 · 10 comments
Closed

Allow proposing a move in cli #26

jkomoros opened this issue Jan 31, 2017 · 10 comments
Labels

Comments

@jkomoros
Copy link
Owner

No description provided.

@jkomoros jkomoros added the cli label Jan 31, 2017
jkomoros added a commit that referenced this issue Feb 1, 2017
…ich does nothing and cannot be dismissed. Part of #26.
@jkomoros
Copy link
Owner Author

jkomoros commented Feb 1, 2017

Next step: create modeProposingMove, with various keybindings. Get rid of controller.proposingMove.

@jkomoros
Copy link
Owner Author

jkomoros commented Feb 2, 2017

@jkomoros
Copy link
Owner Author

jkomoros commented Feb 2, 2017

InputMode grows a overlayVisible() method, which controller.layout() uses to decide if oerlay is visible (and a overlayName())

Modes also have an overlayContent.

Modes need a connection to controller to do this, which implies that they can no longer be global.

We also have a set of inputWidgets that are created. We have IntInputs, StringInputs, BoolInputs. They are all separate views. When in that mode, they are created and positioned over top of the proper points in lines(). That way we can handle selecting them and moving between them.

@jkomoros
Copy link
Owner Author

jkomoros commented Feb 2, 2017

Have modes instantiae and return a new mode object with the right stuff burned in if it's time to transitition: http://gameprogrammingpatterns.com/state.html

@jkomoros
Copy link
Owner Author

jkomoros commented Feb 2, 2017

Next step: disentagle the weird bit where the up/down state has numLines stored in controller. Seems like it should be mode that handles that?

It kind of feels like the current mode should just get all events. But gocui doesn't make it easy to register those...

Looks like we might have to horrendously hackily use Editor, which gets all key presses. :-/ But then we can't use actual selection of views in gocui and will need to do all of it ourselves. ... Then we're mostly just not using gocui. :-/

@jkomoros
Copy link
Owner Author

jkomoros commented Feb 2, 2017

So the plan is to have the main view have Editor = true and an Editor that really just forwards all key presses to c.mode.handleInput().

Then we never set any other view to be Current, because then the keypresses wouldn't be routed to us. the mode input handles handle getting hte keypresses to do the right thing.

jkomoros added a commit that referenced this issue Feb 4, 2017
…structed with a ref to the controller (in the future they will maintain state). InputModes grow a showOverlay(), overlayContent(), and overlayTitle() method. No user-visible change from the refactoring. Part of #26.
jkomoros added a commit that referenced this issue Feb 4, 2017
…. Quitting is (currently) done via just a panic. Part of #26.
jkomoros added a commit that referenced this issue Feb 4, 2017
@jkomoros
Copy link
Owner Author

jkomoros commented Feb 4, 2017

type overlayContent [][]string
type selectedCellEditMode int 

const(
  nonEditable selectedCellEditMode = iota
  editableInt 
  editableString
  editableBool
)

func (o *overlayContent) Size() {
 // Makes sure that every column is sized with enough padding that every cell is the same size
}
mode.overlayContent() overlayContent

mode.selectedOverlayContent() (row, col int)
mode.selectedOverlayEditMode selectedCellEditMore

jkomoros added a commit that referenced this issue Feb 4, 2017
…sed to power InputMode.overlayContent(). Part of #26.
jkomoros added a commit that referenced this issue Feb 6, 2017
… a string with rows delimited by \n. Part of #26.
@jkomoros
Copy link
Owner Author

jkomoros commented Feb 6, 2017

Use overlayContent.columnWidths in the other overlayContent methods

@jkomoros
Copy link
Owner Author

jkomoros commented Feb 7, 2017

Now the question is how to allow editing of the live cells. Does it operate on a string buffer? How often is that committed back into the model? What key commands move between lines?

The easiest way seems to be to always have the value be to burn the value in immediately, and blow away m.Content, forcing it to be re-generated afresh.

Another option:
Select-Cell-Mode:

  • KeyUp/Down highlights a row
  • Space Opens a row for editing
  • Enter commits the move

Edit-cell-mode:

  • Key up/down nudges value up/down (for ints)
  • Key left-right nudges cursor
  • Key backspace, space, etc all type
  • Enter commits teh value back
  • Esc goes back to Select-cell-mode

@jkomoros
Copy link
Owner Author

Obsolete now that #58 is done. Good riddance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant