Browse Source

pgui: If no explicit candidate_inactive style given, use underscore

rdb 4 years ago
parent
commit
089a615adb
1 changed files with 7 additions and 0 deletions
  1. 7 0
      panda/src/pgui/pgEntry.cxx

+ 7 - 0
panda/src/pgui/pgEntry.cxx

@@ -794,9 +794,16 @@ update_text() {
 
 
     } else {
     } else {
       TextPropertiesManager *tp_mgr = TextPropertiesManager::get_global_ptr();
       TextPropertiesManager *tp_mgr = TextPropertiesManager::get_global_ptr();
+      bool has_inactive = tp_mgr->has_properties(_candidate_inactive);
       TextProperties inactive = tp_mgr->get_properties(_candidate_inactive);
       TextProperties inactive = tp_mgr->get_properties(_candidate_inactive);
       TextProperties active = tp_mgr->get_properties(_candidate_active);
       TextProperties active = tp_mgr->get_properties(_candidate_active);
 
 
+      if (!has_inactive) {
+        // Just underscoring the candidate is a sensible default.
+        inactive.set_underscore(true);
+        tp_mgr->set_properties(_candidate_inactive, inactive);
+      }
+
       // Insert the complex sequence of characters required to show the
       // Insert the complex sequence of characters required to show the
       // candidate string in a different color.  This gets inserted at the
       // candidate string in a different color.  This gets inserted at the
       // current cursor position.
       // current cursor position.