Subject: Apply upstream fixes from git
Origin: upstream
Forwarded: not-needed
Author: Martin Budaj <m.budaj@gmail.com>
Last-Update: 2025-05-02
diff --git a/samples/tests/import-equate-issue-584/database.csv.ref b/samples/tests/import-equate-issue-584/database.csv.ref
index bf933e6c..11184eee 100644
--- a/samples/tests/import-equate-issue-584/database.csv.ref
+++ b/samples/tests/import-equate-issue-584/database.csv.ref
@@ -2,8 +2,8 @@ From,To,Length(m),Azimuth(deg),Clino(deg)
 # Equated stations
 3@b,2@a
 # End equated stations
-1@a,2@a,0.00,0.00,0.00
-2@a,3@a,4.47,0.00,-26.57
+1@a,2@a,4.00,0.00,0.00
+2@a,3@a,2.00,0.00,-90.00
 3@b,2@b,3.00,270.00,69.94
 2@b,1@b,2.00,270.00,0.00
 3@b,4@b,9.00,90.00,0.00
diff --git a/thdb1d.cxx b/thdb1d.cxx
index 50ef458b..cb7b39fa 100644
--- a/thdb1d.cxx
+++ b/thdb1d.cxx
@@ -2393,8 +2393,8 @@ void thdb1d::close_loops()
 
     if (cleg->leg->data_type == TT_DATATYPE_NOSURVEY) {
       // ignore cleg->reverse
-      froms = &(this->station_vec[cleg->leg->from.id - 1]);
-      tos = &(this->station_vec[cleg->leg->to.id - 1]);
+      froms = &(this->station_vec[this->station_vec[cleg->leg->from.id - 1].uid - 1]);
+      tos = &(this->station_vec[this->station_vec[cleg->leg->to.id - 1].uid - 1]);
       // ak je no-survey, nastavi mu total statistiku
       cleg->leg->total_dx = tos->x - froms->x;
       cleg->leg->total_dy = tos->y - froms->y;
@@ -2604,7 +2604,7 @@ void thdb1d::print_loops() {
   thlog("REL-ERR ABS-ERR TOTAL-L STS X-ERROR Y-ERROR Z-ERROR STATIONS\n");
   for (i = 0; i < nloops; i++) {
     li = lpr[i].li;
-    thlog(fmt::format("{:6.2}% {}{} {}{} {:3} {}{} {}{} {}{} [",
+    thlog(fmt::format("{:6.2f}% {}{} {}{} {:3} {}{} {}{} {}{} [",
       li->src_length > 0.0 ? 100.0 * li->err_length / li->src_length : 0.0,
 			thdeflocale.format_length(li->err_length,1,totlen), thdeflocale.format_length_units(),			
 			thdeflocale.format_length(li->src_length,1,totlen), thdeflocale.format_length_units(),			
diff --git a/thdb2d.cxx b/thdb2d.cxx
index c7ce26d6..9a8f7d84 100644
--- a/thdb2d.cxx
+++ b/thdb2d.cxx
@@ -56,7 +56,7 @@ static void print_double(const double dbl)
 	if (thisnan(dbl))
 		thlog("    -.--");
 	else
-		thlog(fmt::format("{:8.2}", dbl));
+		thlog(fmt::format("{:8.2f}", dbl));
 }
 
 class thprjx_link {
@@ -1133,7 +1133,7 @@ void thdb2d::log_distortions() {
         strlen(prj->index) > 0 ? prj->index : ""));
       thlog(" AVERAGE  MAXIMAL  SCRAP\n");
       for(i = 0; i < ns; i++)
-        thlog(fmt::format(" {:6.2}%  {:6.2}%  {}@{}\n",ss[i]->avdist, ss[i]->maxdist, ss[i]->name, ss[i]->fsptr->full_name));
+        thlog(fmt::format(" {:6.2f}%  {:6.2f}%  {}@{}\n",ss[i]->avdist, ss[i]->maxdist, ss[i]->name, ss[i]->fsptr->full_name));
       thlog("################### end of scrap distortions ###################\n");
     }
     prjli++;
diff --git a/thlang/texts.txt b/thlang/texts.txt
index ebd357a7..cb12a1c5 100644
--- a/thlang/texts.txt
+++ b/thlang/texts.txt
@@ -4012,7 +4012,7 @@ de: Gesamtlänge
 el: Μήκος
 en: Length
 es: Desarrollo
-fr: Longueur 
+fr: Longueur 
 it: Sviluppo
 mi: Roa a ana
 pl: długość
@@ -4052,7 +4052,7 @@ de: Niveaudifferenz
 el: Βάθος
 en: Depth
 es: Desnivel
-fr: Dénivellation 
+fr: Dénivellation 
 it: Profondità
 mi: Hōhonu a ana, Rētōtanga
 pl: przewyższenie
@@ -4072,7 +4072,7 @@ de: Entdeckung
 el: Εξερευνητές
 en: Explored by
 es: Exploración
-fr: Explorateurs 
+fr: Explorateurs 
 it: Esplorazione
 mi: Kaipokai whenua
 pl: odkryli
@@ -4092,7 +4092,7 @@ de: Entdeckung
 el: Εξερευνητής
 en: Explored by
 es: Exploración
-fr: Explorateur 
+fr: Explorateur 
 it: Esplorazione
 mi: Kaipokai whenua
 pl: odkrył
@@ -4112,7 +4112,7 @@ de: Vermessung
 el: Χαρτογραφήθηκε από τους
 en: Surveyed by
 es: Topografiado por
-fr: Topographes 
+fr: Topographes 
 it: Topografia
 mi: Kairūri
 pl: pomierzyli
@@ -4132,7 +4132,7 @@ de: Vermessung
 el: Χαρτογραφήθηκε από τον
 en: Surveyed by
 es: Topografiado por
-fr: Topographe 
+fr: Topographe 
 it: Topografia
 mi: Kairūri
 pl: mierzył
@@ -4152,7 +4152,7 @@ de: Zeichnung
 el: Σκαρίφημα
 en: Drawn by
 es: Dibujado por
-fr: Dessinateurs 
+fr: Dessinateurs 
 it: Cartografia
 mi: Kaituhi
 pl: rysowali
@@ -4172,7 +4172,7 @@ de: Zeichnung
 el: Σκαρίφημα
 en: Drawn by
 es: Dibujado por
-fr: Dessinateur 
+fr: Dessinateur 
 it: Cartografia
 mi: Kaituhi
 pl: rysował
diff --git a/thtexfonts.cxx b/thtexfonts.cxx
index 8fbea224..dd46e1b7 100644
--- a/thtexfonts.cxx
+++ b/thtexfonts.cxx
@@ -574,6 +574,7 @@ if (ENC_NEW.NFSS==0) {
       // This would require to make math fonts scalable with the \size[.] macro
 
       switch (wc) {
+        case  160: T << "~";   break;  // no-break space
         case 8722: T << "--";  break;  // unicode minus
         default:   T << ".";   break;
       }
