Skip to content

Lines containing only spaces in a code block cause line number calculation errors #12346

Closed
@TCOTC

Description

@TCOTC
Contributor

行号高度与代码高度不一致,仅包含空格的空行会导致行号计算问题

https://ld246.com/article/1724737366356

image

复制下面的代码直接粘贴到代码块里:

import redis.clients.jedis.Jedis;

public class HyperLogLogExample {
    public static void main(String[] args) {
        // 连接 Redis 服务器
        Jedis jedis = new Jedis("localhost");

        // 创建一个 HyperLogLog 实例
        String hyperLogLogKey = "unique_users";
  
        // 模拟用户访问行为,向 HyperLogLog 中添加元素
        jedis.pfadd(hyperLogLogKey, "user1", "user2", "user3", "user4");

        // 获取 HyperLogLog 的基数估计结果
        long estimatedCount = jedis.pfcount(hyperLogLogKey);
        System.out.println("Estimated unique users: " + estimatedCount);

        // 模拟新的用户访问
        jedis.pfadd(hyperLogLogKey, "user5", "user6", "user7");

        // 更新基数估计结果
        estimatedCount = jedis.pfcount(hyperLogLogKey);
        System.out.println("Updated estimated unique users: " + estimatedCount);

        // 关闭 Redis 连接
        jedis.close();
    }
}

Activity

MuuToT

MuuToT commented on Aug 27, 2024

@MuuToT

image
我重新测了下 好似是因为这里有个不可见的东东导致的

TCOTC

TCOTC commented on Aug 27, 2024

@TCOTC
ContributorAuthor

眼神真好,第 10 行的高度为零:

image

gagmeng

gagmeng commented on Aug 27, 2024

@gagmeng

image

TCOTC

TCOTC commented on Aug 27, 2024

@TCOTC
ContributorAuthor

@gagmeng 如果是用了主题,更新一下主题或者跟主题仓库反馈一下

88250

88250 commented on Aug 28, 2024

@88250
Member

我先关闭了,如果还有问题请继续跟帖,谢谢 🙏
I'll close it now. If you have any questions, please continue to post. Thank you 🙏

MuuToT

MuuToT commented on Aug 28, 2024

@MuuToT

我先关闭了,如果还有问题请继续跟帖,谢谢 🙏
I'll close it now. If you have any questions, please continue to post. Thank you 🙏

@88250 这里默认主题也会有这个情况 为啥会有个零高的行啊

88250

88250 commented on Aug 28, 2024

@88250
Member

@Vanessa219 仅包含空格的空行会导致行号计算问题。

reopened this on Aug 28, 2024
added this to the 3.1.5 milestone on Aug 28, 2024
changed the title [-]行号高度与代码高度不一致[/-] [+]Lines containing only spaces in a code block cause line number calculation errors[/+] on Aug 28, 2024
gagmeng

gagmeng commented on Aug 28, 2024

@gagmeng

我先关闭了,如果还有问题请继续跟帖,谢谢 🙏 I'll close it now. If you have any questions, please continue to post. Thank you 🙏

是因为主题的原因导致的吗?我是其它主题也是一样出问题了

TCOTC

TCOTC commented on Aug 28, 2024

@TCOTC
ContributorAuthor

@gagmeng 你截图里的那个行高不一致的症状看起来是主题的问题。因为新版本 DOM 改了,所有主题都需要适配

added a commit that references this issue on Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @88250@Vanessa219@gagmeng@TCOTC@MuuToT

      Issue actions

        Lines containing only spaces in a code block cause line number calculation errors · Issue #12346 · siyuan-note/siyuan