• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tstack / lnav / 21644182840-2777

03 Feb 2026 07:17PM UTC coverage: 68.966% (+0.009%) from 68.957%
21644182840-2777

push

github

tstack
[tidy] remove some unused code

0 of 2 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

51843 of 75172 relevant lines covered (68.97%)

437628.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.22
/src/plain_text_source.cc
1
/**
2
 * Copyright (c) 2022, Timothy Stack
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions are met:
8
 *
9
 * * Redistributions of source code must retain the above copyright notice, this
10
 * list of conditions and the following disclaimer.
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 * this list of conditions and the following disclaimer in the documentation
13
 * and/or other materials provided with the distribution.
14
 * * Neither the name of Timothy Stack nor the names of its contributors
15
 * may be used to endorse or promote products derived from this software
16
 * without specific prior written permission.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY
19
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29

30
#include "plain_text_source.hh"
31

32
#include "base/intern_string.hh"
33
#include "base/itertools.hh"
34
#include "config.h"
35
#include "document.sections.hh"
36
#include "scn/scan.h"
37

UNCOV
38
plain_text_source::plain_text_source(const string_fragment& text)
×
39
{
40
    size_t start = 0;
×
41

42
    for (const auto& line : text.split_lines()) {
×
43
        this->tds_lines.emplace_back(start, attr_line_t::from_ansi_frag(line));
×
44
        start += line.length();
×
45
    }
46
    this->tds_longest_line = this->compute_longest_line();
×
47
}
48

49
plain_text_source&
50
plain_text_source::replace_with(const attr_line_t& text_lines)
77✔
51
{
52
    this->tds_lines.clear();
77✔
53
    this->tds_doc_sections = lnav::document::discover_metadata(text_lines);
77✔
54
    file_off_t off = 0;
77✔
55
    auto lines = text_lines.split_lines();
77✔
56
    while (!lines.empty() && lines.back().empty()) {
77✔
57
        lines.pop_back();
×
58
    }
59
    for (auto& line : lines) {
20,801✔
60
        auto line_len = line.al_string.size() + 1;
20,724✔
61
        this->tds_lines.emplace_back(off, std::move(line));
20,724✔
62
        off += line_len;
20,724✔
63
    }
64
    this->tds_longest_line = this->compute_longest_line();
77✔
65
    if (this->tss_view != nullptr) {
77✔
66
        if (this->tss_view->get_selection()) {
40✔
67
            this->tss_view->set_selection(0_vl);
38✔
68
        }
69
        this->tss_view->set_needs_update();
40✔
70
    }
71
    return *this;
77✔
72
}
77✔
73

74
plain_text_source&
75
plain_text_source::replace_with_mutable(attr_line_t& text_lines,
23✔
76
                                        std::optional<text_format_t> tf)
77
{
78
    this->tds_text_format = tf;
23✔
79
    this->tds_lines.clear();
23✔
80
    if (tf) {
23✔
81
        this->tds_doc_sections = lnav::document::discover(text_lines)
23✔
82
                                     .with_text_format(tf.value())
23✔
83
                                     .perform();
23✔
84
    }
85
    file_off_t off = 0;
23✔
86
    auto lines = text_lines.split_lines();
23✔
87
    while (!lines.empty() && lines.back().empty()) {
23✔
88
        lines.pop_back();
×
89
    }
90
    for (auto& line : lines) {
8,590✔
91
        auto line_len = line.length() + 1;
8,567✔
92
        this->tds_lines.emplace_back(off, std::move(line));
8,567✔
93
        off += line_len;
8,567✔
94
    }
95
    this->tds_longest_line = this->compute_longest_line();
23✔
96
    if (this->tss_view != nullptr) {
23✔
97
        if (this->tss_view->get_selection()) {
4✔
98
            this->tss_view->set_selection(0_vl);
4✔
99
        }
100
        this->tss_view->set_needs_update();
4✔
101
    }
102
    return *this;
23✔
103
}
23✔
104

105
plain_text_source&
106
plain_text_source::replace_with(const std::vector<std::string>& text_lines)
×
107
{
108
    file_off_t off = 0;
×
109
    for (const auto& str : text_lines) {
×
110
        this->tds_lines.emplace_back(off, attr_line_t::from_ansi_str(str));
×
111
        off += str.length() + 1;
×
112
    }
113
    this->tds_longest_line = this->compute_longest_line();
×
114
    if (this->tss_view != nullptr) {
×
115
        if (this->tss_view->get_selection()) {
×
116
            this->tss_view->set_selection(0_vl);
×
117
        }
118
        this->tss_view->set_needs_update();
×
119
    }
120
    return *this;
×
121
}
122

123
plain_text_source&
124
plain_text_source::replace_with(const std::vector<attr_line_t>& text_lines)
21✔
125
{
126
    file_off_t off = 0;
21✔
127
    this->tds_lines.clear();
21✔
128
    for (const auto& al : text_lines) {
453✔
129
        this->tds_lines.emplace_back(off, al);
432✔
130
        off += al.length() + 1;
432✔
131
    }
132
    this->tds_longest_line = this->compute_longest_line();
21✔
133
    if (this->tss_view != nullptr) {
21✔
134
        if (this->tss_view->get_selection()) {
21✔
135
            this->tss_view->set_selection(0_vl);
2✔
136
        }
137
        this->tss_view->set_needs_update();
21✔
138
    }
139
    return *this;
21✔
140
}
141

142
void
143
plain_text_source::clear()
463✔
144
{
145
    this->tds_lines.clear();
463✔
146
    this->tds_longest_line = 0;
463✔
147
    this->tds_text_format = text_format_t::TF_PLAINTEXT;
463✔
148
    if (this->tss_view != nullptr) {
463✔
149
        this->tss_view->set_needs_update();
380✔
150
    }
151
}
463✔
152

153
plain_text_source&
154
plain_text_source::truncate_to(size_t max_lines)
×
155
{
156
    while (this->tds_lines.size() > max_lines) {
×
157
        this->tds_lines.pop_back();
×
158
    }
159
    if (this->tss_view != nullptr) {
×
160
        this->tss_view->set_needs_update();
×
161
    }
162
    return *this;
×
163
}
164

165
size_t
166
plain_text_source::text_line_width(textview_curses& curses)
5,371✔
167
{
168
    return this->tds_longest_line;
5,371✔
169
}
170

171
line_info
172
plain_text_source::text_value_for_line(textview_curses& tc,
7,558✔
173
                                       int row,
174
                                       std::string& value_out,
175
                                       text_sub_source::line_flags_t flags)
176
{
177
    value_out = this->tds_lines[row].tl_value.get_string();
7,558✔
178
    this->tds_line_indent_size = 0;
7,558✔
179
    for (const auto& ch : value_out) {
22,690✔
180
        if (ch == ' ') {
21,429✔
181
            this->tds_line_indent_size += 1;
15,132✔
182
        } else if (ch == '\t') {
6,297✔
183
            do {
184
                this->tds_line_indent_size += 1;
×
185
            } while (this->tds_line_indent_size % 8);
×
186
        } else {
187
            break;
6,297✔
188
        }
189
    }
190

191
    return {};
7,558✔
192
}
193

194
void
195
plain_text_source::text_attrs_for_line(textview_curses& tc,
7,558✔
196
                                       int line,
197
                                       string_attrs_t& value_out)
198
{
199
    value_out = this->tds_lines[line].tl_value.get_attrs();
7,558✔
200
    if (this->tds_reverse_selection && tc.is_selectable()
×
201
        && tc.get_selection() == line)
7,558✔
202
    {
203
        value_out.emplace_back(line_range{0, -1},
×
204
                               VC_STYLE.value(text_attrs::with_reverse()));
×
205
    }
206
    for (const auto& indent : this->tds_doc_sections.m_indents) {
10,004✔
207
        if (indent < this->tds_line_indent_size) {
2,446✔
208
            auto guide_lr = line_range{
209
                (int) indent,
465✔
210
                (int) (indent + 1),
465✔
211
                line_range::unit::codepoint,
212
            };
465✔
213
            value_out.emplace_back(guide_lr,
465✔
214
                                   VC_BLOCK_ELEM.value(block_elem_t{
930✔
215
                                       L'\u258f', role_t::VCR_INDENT_GUIDE}));
216
        }
217
    }
218
}
7,558✔
219

220
size_t
221
plain_text_source::text_size_for_line(textview_curses& tc,
×
222
                                      int row,
223
                                      text_sub_source::line_flags_t flags)
224
{
225
    return this->tds_lines[row].tl_value.length();
×
226
}
227

228
std::optional<text_format_t>
229
plain_text_source::get_text_format() const
5,402✔
230
{
231
    return this->tds_text_format;
5,402✔
232
}
233

234
size_t
235
plain_text_source::compute_longest_line()
121✔
236
{
237
    size_t retval = 0;
121✔
238
    for (auto& iter : this->tds_lines) {
29,844✔
239
        retval = std::max(retval, (size_t) iter.tl_value.length());
29,723✔
240
    }
241
    return retval;
121✔
242
}
243

244
std::optional<vis_line_t>
245
plain_text_source::line_for_offset(file_off_t off) const
6✔
246
{
247
    struct cmper {
248
        bool operator()(const file_off_t& lhs, const text_line& rhs) const
249
        {
250
            return lhs < rhs.tl_offset;
251
        }
252

253
        bool operator()(const text_line& lhs, const file_off_t& rhs) const
57✔
254
        {
255
            return lhs.tl_offset < rhs;
57✔
256
        }
257
    };
258

259
    if (this->tds_lines.empty()) {
6✔
260
        return std::nullopt;
×
261
    }
262

263
    log_trace("line_for_offset(%lld)", off);
6✔
264
    auto iter = std::lower_bound(
6✔
265
        this->tds_lines.begin(), this->tds_lines.end(), off, cmper{});
266
    if (iter == this->tds_lines.end()) {
6✔
267
        if (this->tds_lines.back().contains_offset(off)) {
×
268
            return std::make_optional(
×
269
                vis_line_t(std::distance(this->tds_lines.end() - 1, iter)));
×
270
        }
271
        return std::nullopt;
×
272
    }
273

274
    if (!iter->contains_offset(off) && iter != this->tds_lines.begin()) {
6✔
275
        log_trace("  lower_bound (%lld) does not contain offset",
2✔
276
                  iter->tl_offset);
277
        --iter;
2✔
278
    }
279

280
    auto retval = vis_line_t(std::distance(this->tds_lines.begin(), iter));
12✔
281
    log_trace("  retval=%d", (int) retval);
6✔
282
    return retval;
6✔
283
}
284

285
void
286
plain_text_source::text_crumbs_for_line(int line,
2✔
287
                                        std::vector<breadcrumb::crumb>& crumbs)
288
{
289
    const auto initial_size = crumbs.size();
2✔
290
    const auto& tl = this->tds_lines[line];
2✔
291

292
    this->tds_doc_sections.m_sections_tree.visit_overlapping(
4✔
293
        tl.tl_offset,
2✔
294
        tl.tl_offset + tl.tl_value.length(),
2✔
295
        [&crumbs, initial_size, meta = &this->tds_doc_sections, this](
2✔
296
            const auto& iv) {
297
            auto path = crumbs | lnav::itertools::skip(initial_size)
12✔
298
                | lnav::itertools::map(&breadcrumb::crumb::c_key)
8✔
299
                | lnav::itertools::append(iv.value);
4✔
300
            crumbs.emplace_back(
8✔
301
                iv.value,
4✔
302
                [meta, path]() { return meta->possibility_provider(path); },
12✔
303
                [this, meta, path](const auto& key) {
8✔
304
                    auto curr_node = lnav::document::hier_node::lookup_path(
×
305
                        meta->m_sections_root.get(), path);
×
306
                    if (!curr_node) {
×
307
                        return;
×
308
                    }
309
                    auto* parent_node = curr_node.value()->hn_parent;
×
310

311
                    if (parent_node == nullptr) {
×
312
                        return;
×
313
                    }
314
                    key.match(
×
315
                        [this, parent_node](const std::string& str) {
×
316
                            auto sib_iter
317
                                = parent_node->hn_named_children.find(str);
×
318
                            if (sib_iter
×
319
                                == parent_node->hn_named_children.end()) {
×
320
                                return;
×
321
                            }
322
                            this->line_for_offset(sib_iter->second->hn_start) |
×
323
                                [this](const auto new_top) {
×
324
                                    this->tss_view->set_selection(new_top);
×
325
                                    if (this->tss_view->is_selectable()) {
×
326
                                        this->tss_view->set_top(new_top - 2_vl,
×
327
                                                                false);
328
                                    }
329
                                };
330
                        },
331
                        [this, parent_node](size_t index) {
×
332
                            if (index >= parent_node->hn_children.size()) {
×
333
                                return;
×
334
                            }
335
                            auto sib = parent_node->hn_children[index].get();
×
336
                            this->line_for_offset(sib->hn_start) |
×
337
                                [this](const auto new_top) {
×
338
                                    this->tss_view->set_selection(new_top);
×
339
                                    if (this->tss_view->is_selectable()) {
×
340
                                        this->tss_view->set_top(new_top - 2_vl,
×
341
                                                                false);
342
                                    }
343
                                };
344
                        });
345
                });
346
        });
4✔
347

348
    auto path = crumbs | lnav::itertools::skip(initial_size)
4✔
349
        | lnav::itertools::map(&breadcrumb::crumb::c_key);
4✔
350
    auto node = lnav::document::hier_node::lookup_path(
2✔
351
        this->tds_doc_sections.m_sections_root.get(), path);
2✔
352

353
    if (node && !node.value()->hn_children.empty()) {
2✔
354
        auto poss_provider = [curr_node = node.value()]() {
1✔
355
            std::vector<breadcrumb::possibility> retval;
1✔
356
            for (const auto& child : curr_node->hn_named_children) {
2✔
357
                retval.emplace_back(child.first);
1✔
358
            }
359
            return retval;
1✔
360
        };
361
        auto path_performer = [this, curr_node = node.value()](
2✔
362
                                  const breadcrumb::crumb::key_t& value) {
363
            value.match(
×
364
                [this, curr_node](const std::string& str) {
×
365
                    auto child_iter = curr_node->hn_named_children.find(str);
×
366
                    if (child_iter != curr_node->hn_named_children.end()) {
×
367
                        this->line_for_offset(child_iter->second->hn_start) |
×
368
                            [this](const auto new_top) {
×
369
                                this->tss_view->set_selection(new_top);
×
370
                            };
371
                    }
372
                },
×
373
                [this, curr_node](size_t index) {
×
374
                    auto* child = curr_node->hn_children[index].get();
×
375
                    this->line_for_offset(child->hn_start) |
×
376
                        [this](const auto new_top) {
×
377
                            this->tss_view->set_selection(new_top);
×
378
                        };
379
                });
×
380
        };
1✔
381
        crumbs.emplace_back(
1✔
382
            "", "\u22ef", std::move(poss_provider), std::move(path_performer));
1✔
383
        crumbs.back().c_expected_input = node.value()->hn_named_children.empty()
2✔
384
            ? breadcrumb::crumb::expected_input_t::index
1✔
385
            : breadcrumb::crumb::expected_input_t::index_or_exact;
386
    }
387
}
2✔
388

389
std::optional<vis_line_t>
390
plain_text_source::row_for_anchor(const std::string& id)
5✔
391
{
392
    std::optional<vis_line_t> retval;
5✔
393

394
    if (this->tds_doc_sections.m_sections_root == nullptr) {
5✔
395
        return retval;
×
396
    }
397

398
    const auto& meta = this->tds_doc_sections;
5✔
399

400
    auto is_ptr = startswith(id, "#/");
5✔
401
    if (is_ptr) {
5✔
402
        auto hier_sf = string_fragment::from_str(id).consume_n(2).value();
×
403
        std::vector<lnav::document::section_key_t> path;
×
404

405
        while (!hier_sf.empty()) {
×
406
            auto comp_pair = hier_sf.split_when(string_fragment::tag1{'/'});
×
407
            auto scan_res
408
                = scn::scan_value<int64_t>(comp_pair.first.to_string_view());
×
409
            if (scan_res && scan_res->range().empty()) {
×
410
                path.emplace_back(scan_res->value());
×
411
            } else {
412
                stack_buf allocator;
×
413
                path.emplace_back(
×
414
                    json_ptr::decode(comp_pair.first, allocator).to_string());
×
415
            }
416
            hier_sf = comp_pair.second;
×
417
        }
418

419
        auto lookup_res = lnav::document::hier_node::lookup_path(
×
420
            meta.m_sections_root.get(), path);
×
421
        if (lookup_res) {
×
422
            retval = this->line_for_offset(lookup_res.value()->hn_start);
×
423
        }
424

425
        return retval;
×
426
    }
427

428
    lnav::document::hier_node::depth_first(
5✔
429
        meta.m_sections_root.get(),
430
        [this, &id, &retval](const lnav::document::hier_node* node) {
67✔
431
            for (const auto& child_pair : node->hn_named_children) {
114✔
432
                const auto& child_anchor = to_anchor_string(child_pair.first);
51✔
433

434
                if (child_anchor != id) {
51✔
435
                    continue;
47✔
436
                }
437

438
                retval = this->line_for_offset(child_pair.second->hn_start);
4✔
439
                break;
4✔
440
            }
51✔
441
        });
67✔
442

443
    return retval;
5✔
444
}
445

446
std::unordered_set<std::string>
447
plain_text_source::get_anchors()
×
448
{
449
    std::unordered_set<std::string> retval;
×
450

451
    lnav::document::hier_node::depth_first(
×
452
        this->tds_doc_sections.m_sections_root.get(),
453
        [&retval](const lnav::document::hier_node* node) {
×
454
            for (const auto& child_pair : node->hn_named_children) {
×
455
                retval.emplace(to_anchor_string(child_pair.first));
×
456
            }
457
        });
×
458

459
    return retval;
×
460
}
×
461

462
std::optional<std::string>
463
plain_text_source::anchor_for_row(vis_line_t vl)
4✔
464
{
465
    std::optional<std::string> retval;
4✔
466

467
    if (vl > (ssize_t) this->tds_lines.size()
4✔
468
        || this->tds_doc_sections.m_sections_root == nullptr)
4✔
469
    {
470
        return retval;
×
471
    }
472

473
    const auto& tl = this->tds_lines[vl];
4✔
474
    auto& md = this->tds_doc_sections;
4✔
475
    auto path_for_line = md.path_for_range(
476
        tl.tl_offset, tl.tl_offset + tl.tl_value.al_string.length());
4✔
477

478
    if (path_for_line.empty()) {
4✔
479
        return std::nullopt;
1✔
480
    }
481

482
    if ((path_for_line.size() == 1
3✔
483
         || this->tds_text_format == text_format_t::TF_MARKDOWN)
2✔
484
        && path_for_line.back().is<std::string>())
5✔
485
    {
486
        return to_anchor_string(path_for_line.back().get<std::string>());
2✔
487
    }
488

489
    auto comps
490
        = path_for_line | lnav::itertools::map([](const auto& elem) {
2✔
491
              return elem.match(
492
                  [](const std::string& str) {
×
493
                      stack_buf allocator;
1✔
494
                      return json_ptr::encode(str, allocator).to_string();
2✔
495
                  },
1✔
496
                  [](size_t index) { return fmt::to_string(index); });
5✔
497
          });
1✔
498

499
    return fmt::format(FMT_STRING("#/{}"),
4✔
500
                       fmt::join(comps.begin(), comps.end(), "/"));
2✔
501
}
4✔
502

503
std::optional<vis_line_t>
504
plain_text_source::adjacent_anchor(vis_line_t vl, direction dir)
2✔
505
{
506
    if (vl > (ssize_t) this->tds_lines.size()
2✔
507
        || this->tds_doc_sections.m_sections_root == nullptr)
2✔
508
    {
509
        return std::nullopt;
×
510
    }
511

512
    const auto& tl = this->tds_lines[vl];
2✔
513
    auto path_for_line = this->tds_doc_sections.path_for_range(
514
        tl.tl_offset, tl.tl_offset + tl.tl_value.al_string.length());
2✔
515

516
    log_trace("adjacent_anchor: curr path = %s",
2✔
517
              fmt::format(FMT_STRING("{}"), path_for_line).c_str());
518
    const auto& md = this->tds_doc_sections;
2✔
519
    if (path_for_line.empty()) {
2✔
520
        auto neighbors_res = md.m_sections_root->line_neighbors(vl);
1✔
521
        if (!neighbors_res) {
1✔
522
            return std::nullopt;
×
523
        }
524

525
        switch (dir) {
1✔
526
            case direction::prev: {
×
527
                if (neighbors_res->cnr_previous) {
×
528
                    return this->line_for_offset(
×
529
                        neighbors_res->cnr_previous.value()->hn_start);
×
530
                }
531
                break;
×
532
            }
533
            case direction::next: {
1✔
534
                if (neighbors_res->cnr_next) {
1✔
535
                    return this->line_for_offset(
×
536
                        neighbors_res->cnr_next.value()->hn_start);
×
537
                }
538
                if (!md.m_sections_root->hn_children.empty()) {
1✔
539
                    return this->line_for_offset(
1✔
540
                        md.m_sections_root->hn_children[0]->hn_start);
2✔
541
                }
542
                break;
×
543
            }
544
        }
545
        return std::nullopt;
×
546
    }
547

548
    auto last_key = path_for_line.back();
1✔
549
    path_for_line.pop_back();
1✔
550

551
    auto parent_opt = lnav::document::hier_node::lookup_path(
1✔
552
        md.m_sections_root.get(), path_for_line);
1✔
553
    if (!parent_opt) {
1✔
554
        log_trace("  no parent");
×
555
        return std::nullopt;
×
556
    }
557
    const auto* parent = parent_opt.value();
1✔
558

559
    auto child_hn = parent->lookup_child(last_key);
1✔
560
    if (!child_hn) {
1✔
561
        // XXX "should not happen"
562
        return std::nullopt;
×
563
    }
564

565
    auto neighbors_res = parent->child_neighbors(
3✔
566
        child_hn.value(), tl.tl_offset + tl.tl_value.al_string.length() + 1);
1✔
567
    if (!neighbors_res) {
1✔
568
        log_trace("no neighbors");
×
569
        return std::nullopt;
×
570
    }
571

572
    if (neighbors_res->cnr_previous && last_key.is<std::string>()) {
1✔
573
        auto neighbor_sub
574
            = neighbors_res->cnr_previous.value()->lookup_child(last_key);
1✔
575
        if (neighbor_sub) {
1✔
576
            log_trace("  loading previous child");
×
577
            neighbors_res->cnr_previous = neighbor_sub;
×
578
        }
579
    }
580

581
    if (neighbors_res->cnr_next && last_key.is<std::string>()) {
1✔
582
        auto neighbor_sub
583
            = neighbors_res->cnr_next.value()->lookup_child(last_key);
1✔
584
        if (neighbor_sub) {
1✔
585
            log_trace("  loading next child");
×
586
            neighbors_res->cnr_next = neighbor_sub;
×
587
        }
588
    }
589

590
    switch (dir) {
1✔
591
        case direction::prev: {
×
592
            if (neighbors_res->cnr_previous) {
×
593
                return this->line_for_offset(
×
594
                    neighbors_res->cnr_previous.value()->hn_start);
×
595
            }
596
            break;
×
597
        }
598
        case direction::next: {
1✔
599
            if (neighbors_res->cnr_next) {
1✔
600
                log_trace("  next offset %lld",
1✔
601
                          neighbors_res->cnr_next.value()->hn_start);
602
                return this->line_for_offset(
1✔
603
                    neighbors_res->cnr_next.value()->hn_start);
1✔
604
            }
605
            break;
×
606
        }
607
    }
608

609
    return std::nullopt;
×
610
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc