mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-29 05:06:51 -06:00
Document the functions this PR touches
This commit is contained in:
@@ -1745,6 +1745,8 @@ fn format_cells(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog, confirm:
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert Function: searches names (as the formula language spells them) and descriptions, shows
|
||||
/// each hit's category and description, and starts editing `=NAME(` (or appends to the formula).
|
||||
fn insert_function(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dialog, confirm: &mut bool) {
|
||||
let language = app.ui.language;
|
||||
ui.horizontal(|ui| {
|
||||
|
||||
@@ -160,10 +160,13 @@ pub(crate) fn display_template(text: &str, locale: FormulaLocale, wb: &Workbook,
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// The hint for `name`, empty when there is none.
|
||||
fn sig(name: &str, locale: FormulaLocale, language: Language) -> String {
|
||||
signature(name, locale, language).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Hints keep the formula syntax's name and separators and translate the argument names
|
||||
/// only when the interface language has them all.
|
||||
#[test]
|
||||
fn function_help_follows_the_interface_language_and_the_formula_syntax() {
|
||||
use FormulaLocale::{En, Es};
|
||||
|
||||
@@ -158,6 +158,7 @@ impl Language {
|
||||
/// English text and its translation, sorted by the English.
|
||||
type HelpTable = &'static [(&'static str, &'static str)];
|
||||
|
||||
/// The translation of `english` in a help table (binary search, so the table must stay sorted).
|
||||
fn lookup(table: HelpTable, english: &str) -> Option<&'static str> {
|
||||
let i = table.binary_search_by(|(key, _)| (*key).cmp(english)).ok()?;
|
||||
table.get(i).map(|(_, translated)| *translated)
|
||||
@@ -623,6 +624,7 @@ const JAPANESE: &[(&str, &str)] = &[
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// Help tables are sorted, unique, and keyed by text the function catalog still has.
|
||||
#[test]
|
||||
fn function_help_is_sorted_and_keyed_by_current_catalog_text() {
|
||||
// Lookups binary-search the tables. A key that no longer matches the catalog (an English
|
||||
|
||||
@@ -1749,6 +1749,8 @@ fn page_layout(app: &mut SheetApp, ui: &mut Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Formulas tab: Insert Function, AutoSum, the function-category menus (names in the formula
|
||||
/// language, descriptions in the interface language), defined names, auditing and calculation.
|
||||
fn formulas(app: &mut SheetApp, ui: &mut Ui) {
|
||||
let __k = big_button(ui, Icon::Function, "Insert\nFunction", "Insert Function (⇧F3)", false);
|
||||
control_keytip(app, ui, &__k, "dialog:insertFunction");
|
||||
|
||||
Reference in New Issue
Block a user