[wesnoth-commits] [wesnoth/wesnoth] f23ef6: font: Cleanup link formatting logic

Iris Morelle noreply at github.com
Sat Apr 10 01:05:50 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: f23ef6228291f5fbe5c3bd8d79a667f19d75ad92
      https://github.com/wesnoth/wesnoth/commit/f23ef6228291f5fbe5c3bd8d79a667f19d75ad92
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-04-09 (Fri, 09 Apr 2021)

  Changed paths:
    M changelog.md
    M src/font/text.cpp

  Log Message:
  -----------
  font: Cleanup link formatting logic

Let's internally handle this mess in terms of tokens instead of
delimiter positions.

This alters the code so we don't add and substract ones (1) all over the
place. It also simplifies the final std::string_view::substr() call so
we don't need to count the remainder's length at all.

And more importantly, this makes the case where no delimiters had been
previously found trivial instead of causing it to break and result in no
text being output at all. We also don't start with a size_t value of -1
(actually a very large unsigned value).

Closes #5625.





More information about the Commits mailing list