From e8eea70ab1f70822f756be3750817ac5e24bf24d Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 29 May 2016 13:37:02 -0700 Subject: 3025 - fix a minor annoyance in edit/ When I floor the down-arrow too much, don't scroll unnecessarily off the bottom of the screen. But *do* scroll if there's errors to show. --- 082scenario_screen.cc | 4 +- edit/005-sandbox.mu | 160 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 158 insertions(+), 6 deletions(-) diff --git a/082scenario_screen.cc b/082scenario_screen.cc index f90b926b..9c2cfe71 100644 --- a/082scenario_screen.cc +++ b/082scenario_screen.cc @@ -149,7 +149,7 @@ Name[r]["screen"] = SCREEN; if (curr.name == "assume-screen") { curr.name = "new-fake-screen"; assert(curr.products.empty()); - curr.products.push_back(reagent("screen:address:screen")); + curr.products.push_back(reagent("screen:address:screen/raw")); // only allowed in scenario blocks curr.products.at(0).set_value(SCREEN); } @@ -203,7 +203,6 @@ struct raw_string_stream { :(code) void check_screen(const string& expected_contents, const int color) { - assert(!current_call().default_space); // not supported int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1; int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", ""); assert(data_offset >= 0); @@ -339,7 +338,6 @@ case _DUMP_SCREEN: { :(code) void dump_screen() { - assert(!current_call().default_space); // not supported int screen_location = get_or_insert(Memory, SCREEN) + /*skip refcount*/1; int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", ""); int screen_width = get_or_insert(Memory, screen_location+width_offset); diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index 655d3eca..fadf0d68 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -576,6 +576,160 @@ scenario editor-provides-edited-contents [ ] ] +# keep the bottom of recipes from scrolling off the screen + +scenario scrolling-down-past-bottom-of-recipe-editor [ + local-scope + trace-until 100/app + assume-screen 100/width, 10/height + env:address:programming-environment-data <- new-programming-environment screen:address:screen, [], [] + render-all screen, env + assume-console [ + press enter + press down-arrow + ] + event-loop screen, console:address:console, env + # no scroll + screen-should-contain [ + . run (F4) . + . ┊ . + . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ . + . ┊ . + ] +] + +scenario cursor-down-in-recipe-editor [ + local-scope + trace-until 100/app + assume-screen 100/width, 10/height + env:address:programming-environment-data <- new-programming-environment screen:address:screen, [], [] + render-all screen, env + assume-console [ + press enter + press up-arrow + press down-arrow # while cursor isn't at bottom + ] + event-loop screen, console:address:console, env + cursor:character <- copy 9251/␣ + print screen:address:screen, cursor + # cursor moves back to bottom + screen-should-contain [ + . run (F4) . + . ┊ . + .␣ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ . + . ┊ . + ] +] + +# we'll not use the recipe-editor's 'bottom' element directly, because later +# layers will add other stuff to the left side below the editor (error messages) + +container programming-environment-data [ + recipe-bottom:number +] + +after [ + *env <- put *env, recipe-bottom:offset, row +] + +after [ + { + break-if sandbox-in-focus? + down-arrow?:boolean <- equal k, 65516/down-arrow + break-unless down-arrow? + recipe-editor:address:editor-data <- get *env, recipes:offset + recipe-cursor-row:number <- get *recipe-editor, cursor-row:offset + recipe-editor-bottom:number <- get *recipe-editor, bottom:offset + at-bottom-of-editor?:boolean <- greater-or-equal recipe-cursor-row, recipe-editor-bottom + break-unless at-bottom-of-editor? + more-to-scroll?:boolean <- more-to-scroll? env, screen + break-if more-to-scroll? + loop +next-event:label + } + { + break-if sandbox-in-focus? + page-down?:boolean <- equal k, 65518/page-down + break-unless page-down? + more-to-scroll?:boolean <- more-to-scroll? env, screen + break-if more-to-scroll? + loop +next-event:label + } +] + +after [ + { + break-if sandbox-in-focus? + page-down?:boolean <- equal k, 6/ctrl-f + break-unless page-down? + more-to-scroll?:boolean <- more-to-scroll? env, screen + break-if more-to-scroll? + loop +next-event:label + } +] + +def more-to-scroll? env:address:programming-environment-data, screen:address:screen -> result:boolean [ + local-scope + load-ingredients + recipe-bottom:number <- get *env, recipe-bottom:offset + height:number <- screen-height screen + result <- greater-or-equal recipe-bottom, height +] + +scenario scrolling-down-past-bottom-of-recipe-editor-2 [ + local-scope + trace-until 100/app + assume-screen 100/width, 10/height + env:address:programming-environment-data <- new-programming-environment screen:address:screen, [], [] + render-all screen, env + assume-console [ + # add a line + press enter + # cursor back to top line + press up-arrow + # try to scroll + press page-down # or ctrl-f + ] + event-loop screen, console:address:console, env + # no scroll, and cursor remains at top line + screen-should-contain [ + . run (F4) . + . ┊ . + . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ . + . ┊ . + ] +] + +scenario scrolling-down-past-bottom-of-recipe-editor-3 [ + local-scope + trace-until 100/app + assume-screen 100/width, 10/height + env:address:programming-environment-data <- new-programming-environment screen:address:screen, [], [ab +cd] + render-all screen, env + assume-console [ + # add a line + press enter + # switch to sandbox + press ctrl-n + # move cursor + press down-arrow + ] + event-loop screen, console:address:console, env + cursor:character <- copy 9251/␣ + print screen:address:screen, cursor + # no scroll on recipe side, cursor moves on sandbox side + screen-should-contain [ + . run (F4) . + . ┊ab . + . ┊␣d . + .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + . ┊ . + ] +] + # scrolling through sandboxes scenario scrolling-down-past-bottom-of-sandbox-editor [ @@ -727,7 +881,7 @@ scenario scrolling-down-on-recipe-side [ event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data # hit 'down' in recipe editor assume-console [ - press down-arrow + press page-down ] run [ event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data @@ -737,8 +891,8 @@ scenario scrolling-down-on-recipe-side [ # cursor moves down on recipe side screen-should-contain [ . run (F4) . - . ┊ . - .␣ ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. + .␣ ┊ . + . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊0 edit copy delete . . ┊add 2, 2 . ] -- cgit 1.4.1-2-gfad0 /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
Console

   (X) #0   09/12/06  console commands
   (X) #1   09/12/06  quick find
   (X) #2   09/12/06  open with
   (X) #4   09/12/06  history for console
   (X) #13  09/12/27  display docstring of a command


General

   (X) #5   09/12/06  move code from fm into objects
   (X) #6   09/12/06  move main to __init__
   (X) #7   09/12/06  cooler titlebar
   (X) #8   09/12/17  Add operations to modify files/directories
   (X) #9   09/12/24  add a widget for managing running operations
   (X) #10  09/12/24  sorting
   (X) #11  09/12/27  filter
   (X) #12  09/12/27  jump through the list in a specific order
   (X) #14  09/12/29  make filelists inherit from pagers
   (X) #15  09/12/29  better way of running processes!!~
   (X) #16  10/01/01  list of bookmarks
   (X) #21  10/01/01  write help!
   (X) #22  10/01/03  add getopt options to change flags/mode
   (X) #29  10/01/06  add chmod command
   (X) #30  10/01/06  add a way to create symlinks
   (X) #32  10/01/08  place the (hidden) cursor to a meaningful position
   (X) #34  10/01/09  display free disk space
   (X) #35  10/01/09  display disk usage of files in current directory
   ( ) #36  10/01/11  help coloring is terribly inefficient
   (X) #37  10/01/13  better tab completion for OpenConsole
   ( ) #38  10/01/16  searching in pager
   (X) #39  10/01/17  flushinput not always good
   (X) #42  10/01/17  memorize directory for `` when using :cd
   (X) #43  10/01/18  internally treat the bookmarks ` and ' the same
   ( ) #44  10/01/18  more error messages :P
   (X) #47  10/01/19  less restricive auto preview
   (X) #48  10/01/19  abbreviate commands with first unambiguous substring
   ( ) #50  10/01/19  add more unit tests
   ( ) #51  10/01/21  remove directory.marked_items ?
   (X) #55  10/01/24  allow change of filename when pasting
          you're given the choice between overwriting or appending a "_"
   ( ) #56  10/01/30  warn before deleting mount points
   ( ) #57  10/01/30  warn before deleting unseen marked files
   (X) #58  10/02/04  change the title of the terminal
   (X) #61  10/02/09  show sum of size of marked files
   (X) #63  10/02/15  limit filesize in previews
   ( ) #64  10/02/25  scroll in previews
   (X) #66  10/02/28  explain how colorschemes work
   (X) #70  10/03/14  mouse handler for titlebar
   (X) #71  10/03/21  previews: black/whitelist + read file
   (X) #79  10/04/08  tab number zero
   ( ) #80  10/04/08  when closing tabs, avoid gaps?
   (X) #81  10/04/15  system crash when previewing /proc/kcore with root permissions
   (X) #83  10/04/19  better ways to mark files. eg by regexp, filetype,..
   ( ) #86  10/04/21  narg for move_parent
   ( ) #60  10/02/05  utf support improvable
   ( ) #91  10/05/12  in keys.py, fm.move(right=N) should run with mode=N
   ( ) #92  10/05/14  allow to enter the realpath of a directory
   ( ) #93  10/05/15  pause after running program


Bugs

   (X) #17  10/01/01  why do bookmarks disappear sometimes?
   (X) #18  10/01/01  fix notify widget (by adding a LogView?)
   (X) #19  10/01/01  resizing after pressing g
   (X) #23  10/01/04  stop dir loading with ^C -> wont load anymore
   (X) #25  10/01/06  directories sometimes dont reload correctly
   (X) #26  10/01/06  :delete on symlinks of directories fails
   (X) #31  10/01/06  ^C breaks cd-after-exit by stopping sourced shell script
   (X) #40  10/01/17  freeze with unavailable sshfs
          Not rangers fault (?)
   (X) #41  10/01/17  capital file extensions are not recognized
   (X) #46  10/01/19  old username displayed after using su
   (X) #49  10/01/19  fix unit tests :'(
   (X) #52  10/01/23  special characters in tab completion
   (X) #54  10/01/23  max_dirsize_for_autopreview not working
   (X) #62  10/02/15  curs_set can raise an exception
   (X) #65  10/02/16  "source ranger ranger some/file.txt" shouldn't cd after exit
   (X) #67  10/03/08  terminal title in tty
   (X) #69  10/03/11  tab-completion breaks with Apps subclass
   (X) #73  10/03/21  when clicking on the first column, it goes 1x down
   (X) #74  10/03/21  console doesn't scroll
   (X) #78  10/03/31  broken preview when deleting all files in a directory
   (X) #85  10/04/26  no automatic reload of directory after using :filter
   (X) #87  10/05/10  files are not properly closed after previewing
   ( ) #88  10/05/10  race conditions for data loading from FS
   (X) #90  10/05/11  no link target for broken links
   ( ) #94  10/05/26  "pressed keys" text cut off when chaining ctrl-XYZ keys


Ideas

   ( ) #20  10/01/01  use inotify to monitor filesystem changes
   ( ) #24  10/01/06  progress bar
   (X) #27  10/01/06  hide bookmarks in list which contain hidden dir
   (X) #28  10/01/06  use regexp instead of string for searching
   (X) #33  10/01/08  accelerate mousewheel speed
          won't do this
   (X) #45  10/01/18  hooks for events like setting changes
   (X) #53  10/01/23  merge fm and environment
          won't do this
   (X) #68  10/03/10  threads, to seperate ui and loading
          won't do this
   ( ) #72  10/03/21  ranger daemon which does the slow io tasks
   ( ) #75  10/03/28  navigate in history
   (X) #76  10/03/28  save history between sessions
   (X) #77  10/03/28  colorscheme overlay in options.py
   ( ) #82  10/04/19  :s command for batch renaming
   ( ) #84  10/04/25  use pygments for syntax highlighting
   ( ) #89  10/05/10  branch view


Blocking

   ( ) #60  10/02/05  utf support improvable
   (X) #81  10/04/15  system crash when previewing /proc/kcore with root permissions
9725'>13ba3def ^
1
2
3
4
5
6
7
8
9