+ gnome-calculator-3.26.0-3
Fix reusing result in fr locales (#1536368)
This commit is contained in:
parent
d4f06d4363
commit
06d8b54606
128
0001-Use-_-instead-of-ans-for-last-result-bgo-785107.patch
Normal file
128
0001-Use-_-instead-of-ans-for-last-result-bgo-785107.patch
Normal file
@ -0,0 +1,128 @@
|
||||
From ad694dba6d13633bb5a2ec6f41b3a3fe9758007d Mon Sep 17 00:00:00 2001
|
||||
From: Robert Roth <robert.roth.off@gmail.com>
|
||||
Date: Sun, 17 Sep 2017 00:35:46 +0300
|
||||
Subject: [PATCH] Use _ instead of ans for last result (bgo#785107)
|
||||
|
||||
---
|
||||
help/C/variables.page | 2 +-
|
||||
lib/math-equation.vala | 18 +++++++++---------
|
||||
src/math-variable-popover.vala | 6 +++---
|
||||
3 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/help/C/variables.page b/help/C/variables.page
|
||||
index 47c9f43d..9fdf71a1 100644
|
||||
--- a/help/C/variables.page
|
||||
+++ b/help/C/variables.page
|
||||
@@ -37,7 +37,7 @@
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
- <td><p>ans</p></td>
|
||||
+ <td><p>_</p></td>
|
||||
<td><p>Result of previous calculation</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
diff --git a/lib/math-equation.vala b/lib/math-equation.vala
|
||||
index cfd7b8ee..bb9c7718 100644
|
||||
--- a/lib/math-equation.vala
|
||||
+++ b/lib/math-equation.vala
|
||||
@@ -661,11 +661,11 @@ public class MathEquation : Gtk.SourceBuffer
|
||||
get
|
||||
{
|
||||
/* Check if the previous answer is before start of error token.
|
||||
- * If so, subtract 3 (the length of string "ans") and add actual answer length (ans_end - ans_start) into it. */
|
||||
+ * If so, subtract 1 (the length of string "_") and add actual answer length (ans_end - ans_start) into it. */
|
||||
int ans_start, ans_end;
|
||||
get_ans_offsets (out ans_start, out ans_end);
|
||||
if (ans_start != -1 && ans_start < state.error_token_start)
|
||||
- return state.error_token_start + ans_end - ans_start - 3;
|
||||
+ return state.error_token_start + ans_end - ans_start - 1;
|
||||
|
||||
return state.error_token_start;
|
||||
}
|
||||
@@ -676,11 +676,11 @@ public class MathEquation : Gtk.SourceBuffer
|
||||
get
|
||||
{
|
||||
/* Check if the previous answer is before end of error token.
|
||||
- * If so, subtract 3 (the length of string "ans") and add actual answer length (ans_end - ans_start) into it. */
|
||||
+ * If so, subtract 1 (the length of string "_") and add actual answer length (ans_end - ans_start) into it. */
|
||||
int ans_start, ans_end;
|
||||
get_ans_offsets (out ans_start, out ans_end);
|
||||
if (ans_start != -1 && ans_start < state.error_token_end)
|
||||
- return state.error_token_end + ans_end - ans_start - 3;
|
||||
+ return state.error_token_end + ans_end - ans_start - 1;
|
||||
|
||||
return state.error_token_end;
|
||||
}
|
||||
@@ -693,7 +693,7 @@ public class MathEquation : Gtk.SourceBuffer
|
||||
|
||||
public bool is_result
|
||||
{
|
||||
- get { return equation == "ans"; }
|
||||
+ get { return equation == "_"; }
|
||||
}
|
||||
|
||||
public string equation
|
||||
@@ -707,7 +707,7 @@ public class MathEquation : Gtk.SourceBuffer
|
||||
if (ans_start_mark != null)
|
||||
get_ans_offsets (out ans_start, out ans_end);
|
||||
if (ans_start >= 0)
|
||||
- text = text.splice (text.index_of_nth_char (ans_start), text.index_of_nth_char (ans_end), "ans");
|
||||
+ text = text.splice (text.index_of_nth_char (ans_start), text.index_of_nth_char (ans_end), "_");
|
||||
|
||||
var last_is_digit = false;
|
||||
var index = 0;
|
||||
@@ -1063,7 +1063,7 @@ public class MathEquation : Gtk.SourceBuffer
|
||||
return;
|
||||
|
||||
/* If showing a result return to the equation that caused it */
|
||||
- // FIXME: Result may not be here due to solve (i.e. the user may have entered "ans")
|
||||
+ // FIXME: Result may not be here due to solve (i.e. the user may have entered "_")
|
||||
if (is_result)
|
||||
{
|
||||
undo ();
|
||||
@@ -1388,7 +1388,7 @@ private class MEquation : Equation
|
||||
{
|
||||
var lower_name = name.down ();
|
||||
|
||||
- if (lower_name == "rand" || lower_name == "ans")
|
||||
+ if (lower_name == "rand" || lower_name == "_")
|
||||
return true;
|
||||
|
||||
return m_equation.variables.get (name) != null;
|
||||
@@ -1400,7 +1400,7 @@ private class MEquation : Equation
|
||||
|
||||
if (lower_name == "rand")
|
||||
return new Number.random ();
|
||||
- else if (lower_name == "ans")
|
||||
+ else if (lower_name == "_")
|
||||
return m_equation.answer;
|
||||
else
|
||||
return m_equation.variables.get (name);
|
||||
diff --git a/src/math-variable-popover.vala b/src/math-variable-popover.vala
|
||||
index c9837e02..17c2f87b 100644
|
||||
--- a/src/math-variable-popover.vala
|
||||
+++ b/src/math-variable-popover.vala
|
||||
@@ -11,7 +11,7 @@
|
||||
[GtkTemplate (ui = "/org/gnome/calculator/math-variable-popover.ui")]
|
||||
public class MathVariablePopover : Gtk.Popover
|
||||
{
|
||||
- private static string[] RESERVED_VARIABLE_NAMES = {"ans", "rand"};
|
||||
+ private static string[] RESERVED_VARIABLE_NAMES = {"_", "rand"};
|
||||
|
||||
private MathEquation equation;
|
||||
|
||||
@@ -55,8 +55,8 @@ public class MathVariablePopover : Gtk.Popover
|
||||
|
||||
private void handler (string answer, Number number, int number_base, uint representation_base)
|
||||
{
|
||||
- variable_list.remove (find_row_for_variable ("ans"));
|
||||
- variable_list.add (make_variable_row ("ans", number));
|
||||
+ variable_list.remove (find_row_for_variable ("_"));
|
||||
+ variable_list.add (make_variable_row ("_", number));
|
||||
}
|
||||
|
||||
private Gtk.ListBoxRow? find_row_for_variable (string name)
|
||||
--
|
||||
2.14.3
|
||||
|
@ -1,12 +1,15 @@
|
||||
Name: gnome-calculator
|
||||
Version: 3.26.0
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: A desktop calculator
|
||||
|
||||
License: GPLv3+
|
||||
URL: https://wiki.gnome.org/Apps/Calculator
|
||||
Source0: https://download.gnome.org/sources/%{name}/3.26/%{name}-%{version}.tar.xz
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1536368
|
||||
Patch0: 0001-Use-_-instead-of-ans-for-last-result-bgo-785107.patch
|
||||
|
||||
BuildRequires: desktop-file-utils
|
||||
BuildRequires: gettext
|
||||
BuildRequires: intltool
|
||||
@ -31,7 +34,7 @@ to do its arithmetic to give a high degree of accuracy.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autosetup -p1
|
||||
|
||||
|
||||
%build
|
||||
@ -67,6 +70,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/org.gnome.Calculator
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 22 2018 Bastien Nocera <bnocera@redhat.com> - 3.26.0-3
|
||||
+ gnome-calculator-3.26.0-3
|
||||
- Fix reusing result in fr locales (#1536368)
|
||||
|
||||
* Sat Jan 06 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.26.0-2
|
||||
- Remove obsolete scriptlets
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user