about summary refs log tree commit diff stats
path: root/code/draw.rb
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-04 21:47:15 +0200
committerhut <hut@lavabit.com>2009-07-04 21:47:15 +0200
commitb1855df62ae954142ca7bbc5888212bc75081303 (patch)
treee77c1d24f0a58476def55d3442363267e19be054 /code/draw.rb
parentf0c18d64739e496cf943ea794fa937cff0a7916d (diff)
downloadranger-b1855df62ae954142ca7bbc5888212bc75081303.tar.gz
request a confirmation on deletion
Diffstat (limited to 'code/draw.rb')
-rw-r--r--code/draw.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/code/draw.rb b/code/draw.rb
index b493c846..1b40d47d 100644
--- a/code/draw.rb
+++ b/code/draw.rb
@@ -281,13 +281,14 @@ module Fm
 			btm = lines - 1
 
 			case @buffer
-			when 'seriouslydd', 'dd'
-				puti btm, "Are you serious? Please press y to confirm."
+			when /^delete/, /^dd/
+				puti btm, "#@buffer    ".rjust(cols)
+				puti btm, 'Are you serious? (' + Option.confirm_string + ')'
 
 			when 'S'
 				puti btm, "Sort by (n)ame (s)ize (m)time (c)time (CAPITAL:reversed)"
 			when 't'
-				puti btm, "Toggle (h)idden_files (d)irs_first (f)ilepreview (p)review (w)idebar"
+				puti btm, "Toggle (h)idden_files (d)irs_first (f)ilepreview (p)review (w)idebar (c)d (!)confirm"
 			else
 				attr_set(Color.base)
 				attr_set(Color.info)
ktick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* 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 */
//: Once all code is loaded, save operation ids of instructions and check that
//: nothing's undefined.

:(before "End Instruction Modifying Transforms")
Transform.push_back(update_instruction_operations);  // idempotent

:(code)
void update_instruction_operations(const recipe_ordinal r) {
  trace(9991, "transform") << "--- compute instruction operations for recipe " << get(Recipe, r).name << end();
  recipe& caller = get(Recipe, r);
//?   cerr << "--- compute instruction operations for recipe " << caller.name << '\n';
  for (int index = 0;  index < SIZE(caller.steps);  ++index) {
    instruction& inst = caller.steps.at(index);
    if (inst.is_label) continue;
    if (!contains_key(Recipe_ordinal, inst.name)) {
      raise << maybe(caller.name) << "instruction '" << inst.name << "' has no recipe in '" << to_original_string(inst) << "'\n" << end();
      continue;
    }
    inst.operation = get(Recipe_ordinal, inst.name);
    // End Instruction Operation Checks
  }
}

// hook to suppress inserting recipe name into errors
string maybe(string recipe_name) {
  // End maybe(recipe_name) Special-cases
  return recipe_name + ": ";
}

:(scenarios transform)
:(scenario missing_arrow)
% Hide_errors = true;
def main [
  1:number , copy 0  # typo: ',' instead of '<-'
]
+error: main: instruction '1:number' has no recipe in '1:number copy, 0'