about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-03-24 20:30:40 +0100
committerGitHub <noreply@github.com>2022-03-24 20:30:40 +0100
commit409268e2b6644b583a0e0c42648bb16d0cf6b3eb (patch)
tree70094b98fcbb6c1a605495d28c1779b2bc5806c0
parent39b276986b99ecbebd4c9cca3bdc1722e5ec2c24 (diff)
parent923af3ba38361b620066741bc8fa6b08cd3e9325 (diff)
downloadprofani-tty-409268e2b6644b583a0e0c42648bb16d0cf6b3eb.tar.gz
Merge pull request #1655 from profanity-im/win-autocomplete
Reset url autocompletion after open/save
-rw-r--r--src/command/cmd_funcs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index b061f9bf..8912c8cd 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -9294,6 +9294,8 @@ cmd_url_open(ProfWin* window, const char* const command, gchar** args)
     _url_external_method(cmd_template, url, NULL);
 
 out:
+    // reset autocompletion to start from latest url and not where we left of
+    autocomplete_reset(window->urls_ac);
 
     free(cmd_template);
     free(filename);
@@ -9350,6 +9352,8 @@ cmd_url_save(ProfWin* window, const char* const command, gchar** args)
     }
 
 out:
+    // reset autocompletion to start from latest url and not where we left of
+    autocomplete_reset(window->urls_ac);
 
     free(filename);
     free(cmd_template);
/ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .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 */
:(before "End Primitive Recipe Declarations")
RANDOM,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "random", RANDOM);
:(before "End Primitive Recipe Checks")
case RANDOM: {
  break;
}
:(before "End Primitive Recipe Implementations")
case RANDOM: {
  // todo: limited range of numbers, might be imperfectly random
  // todo: thread state in extra ingredients and products
  products.resize(1);
  products.at(0).push_back(rand());
  break;
}

:(before "End Primitive Recipe Declarations")
MAKE_RANDOM_NONDETERMINISTIC,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "make-random-nondeterministic", MAKE_RANDOM_NONDETERMINISTIC);
:(before "End Primitive Recipe Checks")
case MAKE_RANDOM_NONDETERMINISTIC: {
  break;
}
:(before "End Primitive Recipe Implementations")
case MAKE_RANDOM_NONDETERMINISTIC: {
  srand(time(NULL));
  break;
}

:(before "End Primitive Recipe Declarations")
ROUND,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "round", ROUND);
:(before "End Primitive Recipe Checks")
case ROUND: {
  if (SIZE(inst.ingredients) != 1) {
    raise_error << maybe(get(Recipe, r).name) << "'round' requires exactly one ingredient, but got " << inst.to_string() << '\n' << end();
    break;
  }
  if (!is_mu_number(inst.ingredients.at(0))) {
    raise_error << maybe(get(Recipe, r).name) << "first ingredient of 'round' should be a number, but got " << inst.ingredients.at(0).original_string << '\n' << end();
    break;
  }
  break;
}
:(before "End Primitive Recipe Implementations")
case ROUND: {
  products.resize(1);
  products.at(0).push_back(rint(ingredients.at(0).at(0)));
  break;
}

:(scenario round_to_nearest_integer)
recipe main [
  1:number <- round 12.2
]
+mem: storing 12 in location 1

:(before "End Includes")
#include<math.h>